[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241003092826.1942901-2-m.szyprowski@samsung.com>
Date: Thu, 3 Oct 2024 11:28:25 +0200
From: Marek Szyprowski <m.szyprowski@...sung.com>
To: Raspberry Pi Kernel Maintenance <kernel-list@...pberrypi.com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Cc: Marek Szyprowski <m.szyprowski@...sung.com>, Maarten Lankhorst
<maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Dave Stevenson
<dave.stevenson@...pberrypi.com>, Javier Martinez Canillas
<javierm@...hat.com>
Subject: [PATCH 1/2] drm/fbdev-helper: fail if driver provides no fbdev/fb
probe functions
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@...sung.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
Powered by blists - more mailing lists