Skip to contentSkip to conversation

qxl: check for kmap failures

PATCH In review Dan Carpenter 1 participant 1 message Jul 11, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 qxl: check for kmap failures

If kmap fails, it leads to memory corruption.

Fixes f64122c1f6ad ('drm: add new QXL driver. (v1.4)')
drivers/gpu/drm/qxl/qxl_draw.c +2 -0
index 56e1d63..6e6c760 100644
@@ -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);
+	if (ret)
+		return ret;
 	pal->num_ents = 2;
 	pal->unique = unique++;
 	if (visual == FB_VISUAL_TRUECOLOR || visual == FB_VISUAL_DIRECTCOLOR) {