drivers/scsi/st.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
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
I sincerely apologize - I sent the wrong patch in my previous email.
Please disregard my previous patch submission.
在 2026年06月03日 15:11, 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);
© 2016 - 2026 Red Hat, Inc.