[PATCH 1/2] drm/fbdev-helper: fail if driver provides no fbdev/fb probe functions

Marek Szyprowski m.szyprowski at samsung.com
Thu Oct 3 09:28:25 UTC 2024


If caller doesn't provide driver->fbdev_probe nor funcs->fb_probe, then
fail early instead of causing potential NULL pointer dereference, because
fb_helper->fb won't be initialized in such case.

Fixes: 5d08c44e47b9 ("drm/fbdev: Add memory-agnostic fbdev client")
Signed-off-by: Marek Szyprowski <m.szyprowski at samsung.com>
---
 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 d5e8994345bb..fc260832326c 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1635,6 +1635,9 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper)
 		ret = dev->driver->fbdev_probe(fb_helper, &sizes);
 	else if (fb_helper->funcs)
 		ret = fb_helper->funcs->fb_probe(fb_helper, &sizes);
+	else
+		ret = -ENODEV;
+
 	if (ret < 0)
 		return ret;
 
-- 
2.34.1



More information about the dri-devel mailing list