Skip to contentSkip to conversation

drm/omapdrm: don't deref error pointer in the omap_fbdev_create error path

PATCH New Defang Bo 1 participant 1 message Dec 25, 2020

Subsystems (3)
lore
Share & tools
lore

Defang Bo

author
#0 lore raw

PATCH 1/1 drm/omapdrm: don't deref error pointer in the omap_fbdev_create error path

From: bodefang <[email protected]>

Similar to commit <789d4c300>("drm/msm: don't deref error pointer in the msm_fbdev_create error path") the error pointer returned by omap_framebuffer_init gets passed to drm_framebuffer_remove. The latter handles only Null pointers,thus a nasty crash will occur.

---
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/omapdrm/omap_fbdev.c +2 -6
index 3f6cfc2..372afd4 100644
@@ -141,8 +141,7 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 		 * to unref the bo:
 		 */
 		drm_gem_object_put(fbdev->bo);
-		ret = PTR_ERR(fb);
-		goto fail;
+		return PTR_ERR(fb);
 	}
 
 	/* note: this keeps the bo pinned.. which is perhaps not ideal,
@@ -200,10 +199,7 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 
 fail:
 
-	if (ret) {
-		if (fb)
-			drm_framebuffer_remove(fb);
-	}
+	drm_framebuffer_remove(fb);
 
 	return ret;
 }
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel