mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Su, Xuemin" <xuemin.su@intel.com>
To: airlied@linux.ie, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Cc: bo.he@intel.com, xuemin.su@intel.com, yanmin_zhang@linux.intel.com
Subject: [PATCH V3] drm_crtc: check if fb_create return NULL
Date: Thu, 24 Jan 2013 08:36:44 +0800	[thread overview]
Message-ID: <1358987804.18561.22.camel@suxuemin.sh.intel.com> (raw)

From: xueminsu <xuemin.su@intel.com>
Date: Tue, 22 Jan 2013 22:39:39 +0800
Subject: [PATCH] drm_crtc: check if fb_create return NULL

Some buggy driver may still return NULL in fb_create,
which leads to kernel panic.

Signed-off-by: xueminsu <xuemin.su@intel.com>
---
 drivers/gpu/drm/drm_crtc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index f2d667b..ae613ec 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2172,6 +2172,8 @@ int drm_mode_addfb(struct drm_device *dev,
 		ret = PTR_ERR(fb);
 		goto out;
 	}
+	/* some buggy driver may return NULL here, which may cause panic */
+	BUG_ON(!fb);
 
 	or->fb_id = fb->base.id;
 	list_add(&fb->filp_head, &file_priv->fbs);
-- 
1.7.6




             reply	other threads:[~2013-01-24  0:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24  0:36 Su, Xuemin [this message]
2013-01-24  8:31 ` Jani Nikula
2013-01-24  8:46   ` Su, Xuemin
2013-01-24  9:04     ` Jani Nikula
2013-01-31  0:55       ` Su, Xuemin
2013-01-31  8:22         ` Daniel Vetter

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=1358987804.18561.22.camel@suxuemin.sh.intel.com \
    --to=xuemin.su@intel.com \
    --cc=airlied@linux.ie \
    --cc=bo.he@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yanmin_zhang@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®