qxl: check for kmap failures
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 11 Jul 2016 08:46:33 +0000 (11:46 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 12 Jul 2016 14:20:17 +0000 (16:20 +0200)
If kmap fails, it leads to memory corruption.

Fixes: f64122c1f6ad ('drm: add new QXL driver. (v1.4)')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20160711084633.GA31411@mwanda
drivers/gpu/drm/qxl/qxl_draw.c

index 56e1d63..6e6c760 100644 (file)
@@ -136,6 +136,8 @@ static int qxl_palette_create_1bit(struct qxl_bo *palette_bo,
                                 * correctly globaly, since that would require
                                 * tracking all of our palettes. */
        ret = qxl_bo_kmap(palette_bo, (void **)&pal);
                                 * correctly globaly, since that would require
                                 * tracking all of our palettes. */
        ret = qxl_bo_kmap(palette_bo, (void **)&pal);
+       if (ret)
+               return ret;
        pal->num_ents = 2;
        pal->unique = unique++;
        if (visual == FB_VISUAL_TRUECOLOR || visual == FB_VISUAL_DIRECTCOLOR) {
        pal->num_ents = 2;
        pal->unique = unique++;
        if (visual == FB_VISUAL_TRUECOLOR || visual == FB_VISUAL_DIRECTCOLOR) {