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 V2 RESEND] drm_crtc: check if fb_create return NULL
Date: Wed, 23 Jan 2013 11:19:27 +0800 [thread overview]
Message-ID: <1358911167.18561.20.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 | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index f2d667b..b748498 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2172,6 +2172,13 @@ 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 */
+ if (!fb) {
+ WARN(1, "%pf should not return NULL.",
+ dev->mode_config.funcs->fb_create);
+ ret = -EINVAL;
+ goto out;
+ }
or->fb_id = fb->base.id;
list_add(&fb->filp_head, &file_priv->fbs);
--
1.7.6
next reply other threads:[~2013-01-23 3:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-23 3:19 Su, Xuemin [this message]
2013-01-23 9:53 ` Daniel Vetter
2013-01-24 0:27 ` Su, Xuemin
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=1358911167.18561.20.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®