Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: st: Fix lock leak in st_ioctl()
@ 2026-05-20  7:40 Hongling Zeng
  2026-05-20  7:52 ` Hongling Zeng
  0 siblings, 1 reply; 3+ messages in thread
From: Hongling Zeng @ 2026-05-20  7:40 UTC (permalink / raw)
  To: Kai.Makisara, James.Bottomley, martin.petersen, djeffery,
	jmeneghi
  Cc: linux-scsi, linux-kernel, zhongling0719, Hongling Zeng

The default case in the switch statement returns directly from
st_common_ioctl() without releasing &STp->lock, causing a lock
imbalance. Fix by jumping to the out label to properly release
the lock.

Fixes: b37d70c0df85 ("scsi: st: Separate st-unique ioctl handling from SCSI common ioctl handling")
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
---
 drivers/scsi/st.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index f1c3c4946637..3b08992e1b10 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3628,7 +3628,8 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg)
 	case MTIOCTOP:
 		break;
 	default:
-		return st_common_ioctl(STp, STm, file, cmd_in, arg);
+		retval = st_common_ioctl(STp, STm, file, cmd_in, arg);
+		goto out;
 	}
 
 	cmd_type = _IOC_TYPE(cmd_in);
-- 
2.25.1


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

end of thread, other threads:[~2026-05-20 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-20  7:40 [PATCH] scsi: st: Fix lock leak in st_ioctl() Hongling Zeng
2026-05-20  7:52 ` Hongling Zeng
2026-05-20 16:25   ` Bart Van Assche

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