[PATCH] drm: Prevent early NULL dereference of fb_helper->fb

Chris Wilson chris at chris-wilson.co.uk
Wed Jul 19 15:24:50 UTC 2017


Prior to the fbdev being asynchronously configured on boot, the
fb_helper->fb may be unset.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101767
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Thierry Reding <treding at nvidia.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
---
This may not be necessary with the recent async rework? One hopes.
---
 drivers/gpu/drm/drm_fb_helper.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 42090fe00ef9..a44b6b434fa0 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1502,6 +1502,9 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
 	if (var->pixclock != 0 || in_dbg_master())
 		return -EINVAL;
 
+	if (!fb) /* too early, fbdev is not yet setup */
+		return -EINVAL;
+
 	/*
 	 * Changes struct fb_var_screeninfo are currently not pushed back
 	 * to KMS, hence fail if different settings are requested.
-- 
2.13.3



More information about the dri-devel mailing list