mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/fb-helper: Fix a locking bug in an error path
@ 2026-04-03 20:53 Bart Van Assche
  2026-04-07  7:44 ` Thomas Zimmermann
  2026-04-09 10:10 ` Javier Martinez Canillas
  0 siblings, 2 replies; 6+ messages in thread
From: Bart Van Assche @ 2026-04-03 20:53 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: Maxime Ripard, linux-kernel, Bart Van Assche, Thomas Zimmermann,
	Christian König, Dmitry Baryshkov, Javier Martinez Canillas,
	David Airlie, Simona Vetter, Nathan Chancellor

The name of the function __drm_fb_helper_initial_config_and_unlock() and
also the comment above that function make it clear that all code paths
in this function should unlock fb_helper->lock before returning. Add a
mutex_unlock() call in the only code path where it is missing. This has
been detected by the Clang thread-safety analyzer.

Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Christian König <christian.koenig@amd.com> # radeon
Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> # msm
Cc: Javier Martinez Canillas <javierm@redhat.com>
Fixes: 63c971af4036 ("drm/fb-helper: Allocate and release fb_info in single place")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/gpu/drm/drm_fb_helper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 05803169bed5..16bfbfb0af16 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1641,8 +1641,10 @@ __drm_fb_helper_initial_config_and_unlock(struct drm_fb_helper *fb_helper)
 	drm_client_modeset_probe(&fb_helper->client, width, height);
 
 	info = drm_fb_helper_alloc_info(fb_helper);
-	if (IS_ERR(info))
+	if (IS_ERR(info)) {
+		mutex_unlock(&fb_helper->lock);
 		return PTR_ERR(info);
+	}
 
 	ret = drm_fb_helper_single_fb_probe(fb_helper);
 	if (ret < 0) {

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-04-09 10:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-03 20:53 [PATCH] drm/fb-helper: Fix a locking bug in an error path Bart Van Assche
2026-04-07  7:44 ` Thomas Zimmermann
2026-04-07  7:47   ` Thomas Zimmermann
2026-04-07 15:17     ` Bart Van Assche
2026-04-07 15:27       ` Thomas Zimmermann
2026-04-09 10:10 ` Javier Martinez Canillas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®