* [PATCH] md: fix mddev_unlock() called without holding lock in lbs_store()
@ 2026-09-20 10:37 Jack Wang
2026-10-05 4:57 ` Jinpu Wang
0 siblings, 1 reply; 3+ messages in thread
From: Jack Wang @ 2026-09-20 10:37 UTC (permalink / raw)
To: Song Liu, Yu Kuai; +Cc: Li Nan, Xiao Ni, linux-raid, linux-kernel, Jack Wang
From: Jack Wang <jinpu.wang@cloud.ionos.com>
lbs_store() jumped to the unlock label on mddev_lock() failure,
calling mddev_unlock() on a mutex that was never acquired. Return
directly instead.
Fixes: 62ed1b582246 ("md: allow configuring logical block size")
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
---
drivers/md/md.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 680b34a63cb3..41fbe5d9961a 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -6048,11 +6048,10 @@ lbs_store(struct mddev *mddev, const char *buf, size_t len)
err = mddev_lock(mddev);
if (err)
- goto unlock;
+ return err;
err = mddev_set_logical_block_size(mddev, lbs);
-unlock:
mddev_unlock(mddev);
return err ?: len;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] md: fix mddev_unlock() called without holding lock in lbs_store()
2026-09-20 10:37 [PATCH] md: fix mddev_unlock() called without holding lock in lbs_store() Jack Wang
@ 2026-10-05 4:57 ` Jinpu Wang
2026-10-05 17:07 ` yu kuai
0 siblings, 1 reply; 3+ messages in thread
From: Jinpu Wang @ 2026-10-05 4:57 UTC (permalink / raw)
To: Song Liu, Yu Kuai; +Cc: Li Nan, Xiao Ni, linux-raid, linux-kernel
On Sun, Sep 20, 2026 at 12:37 PM Jack Wang <jinpu.wang@ionos.com> wrote:
>
> From: Jack Wang <jinpu.wang@cloud.ionos.com>
>
> lbs_store() jumped to the unlock label on mddev_lock() failure,
> calling mddev_unlock() on a mutex that was never acquired. Return
> directly instead.
>
> Fixes: 62ed1b582246 ("md: allow configuring logical block size")
> Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
ping?
> ---
> drivers/md/md.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 680b34a63cb3..41fbe5d9961a 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -6048,11 +6048,10 @@ lbs_store(struct mddev *mddev, const char *buf, size_t len)
>
> err = mddev_lock(mddev);
> if (err)
> - goto unlock;
> + return err;
>
> err = mddev_set_logical_block_size(mddev, lbs);
>
> -unlock:
> mddev_unlock(mddev);
> return err ?: len;
> }
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] md: fix mddev_unlock() called without holding lock in lbs_store()
2026-10-05 4:57 ` Jinpu Wang
@ 2026-10-05 17:07 ` yu kuai
0 siblings, 0 replies; 3+ messages in thread
From: yu kuai @ 2026-10-05 17:07 UTC (permalink / raw)
To: Jinpu Wang, Song Liu, yu kuai; +Cc: Li Nan, Xiao Ni, linux-raid, linux-kernel
Hi,
在 2026/10/5 12:57, Jinpu Wang 写道:
> On Sun, Sep 20, 2026 at 12:37 PM Jack Wang <jinpu.wang@ionos.com> wrote:
>> From: Jack Wang <jinpu.wang@cloud.ionos.com>
>>
>> lbs_store() jumped to the unlock label on mddev_lock() failure,
>> calling mddev_unlock() on a mutex that was never acquired. Return
>> directly instead.
>>
>> Fixes: 62ed1b582246 ("md: allow configuring logical block size")
>> Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
> ping?
>> ---
>> drivers/md/md.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/md/md.c b/drivers/md/md.c
>> index 680b34a63cb3..41fbe5d9961a 100644
>> --- a/drivers/md/md.c
>> +++ b/drivers/md/md.c
>> @@ -6048,11 +6048,10 @@ lbs_store(struct mddev *mddev, const char *buf, size_t len)
>>
>> err = mddev_lock(mddev);
>> if (err)
>> - goto unlock;
>> + return err;
>>
>> err = mddev_set_logical_block_size(mddev, lbs);
>>
>> -unlock:
>> mddev_unlock(mddev);
>> return err ?: len;
>> }
>> --
>> 2.43.0
Already applied, looks like I forgot to reply to the email.
md: fix mddev_unlock() called without holding lock in lbs_store() -
kernel/git/mdraid/linux.git - song's fork of linux.git <https://git.kernel.org/pub/scm/linux/kernel/git/mdraid/linux.git/commit/?id=68dab5c14aaff17686df22ba1f1eea3b3433797a>
>>
--
Thanks,
Kuai
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-05 17:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-20 10:37 [PATCH] md: fix mddev_unlock() called without holding lock in lbs_store() Jack Wang
2026-10-05 4:57 ` Jinpu Wang
2026-10-05 17:07 ` yu kuai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox