[PATCH] drm/fb-helper: Fix a potential NULL dereference
Dan Carpenter
dan.carpenter at oracle.com
Wed Dec 6 13:07:49 UTC 2017
We recently modified drm_fb_helper_single_add_all_connectors() to allow
NULL "fb_helper" pointers. But the problem is that it gets
dereferenced before we checked for NULL.
Fixes: c777990fb45b ("drm/fb-helper: Handle function NULL argument")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 6654f2f87775..f73457e5bbbc 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -178,7 +178,6 @@ EXPORT_SYMBOL(drm_fb_helper_add_one_connector);
*/
int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
{
- struct drm_device *dev = fb_helper->dev;
struct drm_connector *connector;
struct drm_connector_list_iter conn_iter;
int i, ret = 0;
@@ -187,7 +186,7 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
return 0;
mutex_lock(&fb_helper->lock);
- drm_connector_list_iter_begin(dev, &conn_iter);
+ drm_connector_list_iter_begin(fb_helper->dev, &conn_iter);
drm_for_each_connector_iter(connector, &conn_iter) {
ret = __drm_fb_helper_add_one_connector(fb_helper, connector);
if (ret)
More information about the dri-devel
mailing list