All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: bridge: cdns-mhdp8546: Fix missing mutex unlock on error path
@ 2025-09-04  3:44 Qi Xi
  2025-09-09 13:59 ` Luca Ceresoli
  2025-09-16 13:52 ` Luca Ceresoli
  0 siblings, 2 replies; 6+ messages in thread
From: Qi Xi @ 2025-09-04  3:44 UTC (permalink / raw)
  To: bobo.shaobowang, xiqi2, andrzej.hajda, neil.armstrong, rfoss,
	Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
	mripard, tzimmermann, airlied, simona, lumag, dianders, lyude,
	luca.ceresoli, andy.yan, viro, mordan, amishin, dri-devel
  Cc: linux-kernel

Add missing mutex unlock before returning from the error path in
cdns_mhdp_atomic_enable().

Fixes: 935a92a1c400 ("drm: bridge: cdns-mhdp8546: Fix possible null pointer dereference")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qi Xi <xiqi2@huawei.com>
---
 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
index a614d1384f71..38726ae1bf15 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
@@ -1984,8 +1984,10 @@ static void cdns_mhdp_atomic_enable(struct drm_bridge *bridge,
 	mhdp_state = to_cdns_mhdp_bridge_state(new_state);
 
 	mhdp_state->current_mode = drm_mode_duplicate(bridge->dev, mode);
-	if (!mhdp_state->current_mode)
-		return;
+	if (!mhdp_state->current_mode) {
+		ret = -EINVAL;
+		goto out;
+	}
 
 	drm_mode_set_name(mhdp_state->current_mode);
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [PATCH] drm: bridge: cdns-mhdp8546: Fix missing mutex unlock on error path
@ 2024-04-19 11:36 Aleksandr Mishin
  2024-04-19 15:02 ` Dmitry Baryshkov
  2024-04-19 19:47 ` Markus Elfring
  0 siblings, 2 replies; 6+ messages in thread
From: Aleksandr Mishin @ 2024-04-19 11:36 UTC (permalink / raw)
  To: Robert Foss
  Cc: Aleksandr Mishin, Swapnil Jakhade, Andrzej Hajda, Neil Armstrong,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter, Tomi Valkeinen, Uwe Kleine-König,
	Nikhil Devshatwar, Aradhya Bhatia, Jani Nikula, Rob Herring,
	Zhu Wang, Yuti Amonkar, Jyri Sarha, Quentin Schulz, dri-devel,
	linux-kernel, lvc-project

In cdns_mhdp_atomic_enable(), there is an error return on failure of
drm_mode_duplicate() which leads to the mutex remaining locked.
Add a mutex unlock call.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 935a92a1c400 ("drm: bridge: cdns-mhdp8546: Fix possible null pointer dereference")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
---
This patch is against drm-misc-next branch of drm-misc repo.

 drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
index 8a91ef0ae065..65a4bd09d9c6 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c
@@ -2059,8 +2059,10 @@ static void cdns_mhdp_atomic_enable(struct drm_bridge *bridge,
 	mhdp_state = to_cdns_mhdp_bridge_state(new_state);
 
 	mhdp_state->current_mode = drm_mode_duplicate(bridge->dev, mode);
-	if (!mhdp_state->current_mode)
-		return;
+	if (!mhdp_state->current_mode) {
+		ret = -EINVAL;
+		goto out;
+	}
 
 	drm_mode_set_name(mhdp_state->current_mode);
 
-- 
2.30.2


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

end of thread, other threads:[~2025-09-16 13:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04  3:44 [PATCH] drm: bridge: cdns-mhdp8546: Fix missing mutex unlock on error path Qi Xi
2025-09-09 13:59 ` Luca Ceresoli
2025-09-16 13:52 ` Luca Ceresoli
  -- strict thread matches above, loose matches on Subject: below --
2024-04-19 11:36 Aleksandr Mishin
2024-04-19 15:02 ` Dmitry Baryshkov
2024-04-19 19:47 ` Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.