All of lore.kernel.org
 help / color / mirror / Atom feed
From: Defang Bo <bodefang@126.com>
To: 603571786@qq.com, tomi.valkeinen@ti.com, airlied@linux.ie,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: bodefang <bodefang@126.com>
Subject: [PATCH] drm/omapdrm: don't deref error pointer in the omap_fbdev_create error path
Date: Fri, 25 Dec 2020 11:05:29 +0800	[thread overview]
Message-ID: <1608865530-2166206-1-git-send-email-bodefang@126.com> (raw)

From: bodefang <bodefang@126.com>

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.

Signed-off-by: bodefang <bodefang@126.com>
---
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 3f6cfc2..372afd4 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -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;
 }
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2020-12-25  9:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-25  3:05 Defang Bo [this message]
2020-12-28  2:46 [PATCH] drm/omapdrm: don't deref error pointer in the omap_fbdev_create error path Defang Bo
2020-12-28  2:46 ` Defang Bo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1608865530-2166206-1-git-send-email-bodefang@126.com \
    --to=bodefang@126.com \
    --cc=603571786@qq.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.