[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1358908327.18561.15.camel@suxuemin.sh.intel.com>
Date: Wed, 23 Jan 2013 10:32:07 +0800
From: "Su, Xuemin" <xuemin.su@...el.com>
To: airlied@...ux.ie, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Cc: bo.he@...el.com, xuemin.su@...el.com, yanmin_zhang@...ux.intel.com
Subject: [PATCH] drm_crtc: check if fb_create return NULL
From: xueminsu <xuemin.su@...el.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@...el.com>
---
drivers/gpu/drm/drm_crtc.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index f2d667b..4ed0aed 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2172,6 +2172,12 @@ 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);
+ return -EINVAL;
+ }
or->fb_id = fb->base.id;
list_add(&fb->filp_head, &file_priv->fbs);
--
1.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists