From: Jack Wang <jinpu.wang@ionos.com>
To: Song Liu <song@kernel.org>, Yu Kuai <yukuai@fygo.io>
Cc: Li Nan <magiclinan@didiglobal.com>, Xiao Ni <xiao@kernel.org>,
linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
Jack Wang <jinpu.wang@cloud.ionos.com>
Subject: [PATCH] md: fix mddev_unlock() called without holding lock in lbs_store()
Date: Sun, 20 Sep 2026 12:37:05 +0200 [thread overview]
Message-ID: <20260920103705.23191-1-jinpu.wang@ionos.com> (raw)
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
reply other threads:[~2026-09-20 10:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260920103705.23191-1-jinpu.wang@ionos.com \
--to=jinpu.wang@ionos.com \
--cc=jinpu.wang@cloud.ionos.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=magiclinan@didiglobal.com \
--cc=song@kernel.org \
--cc=xiao@kernel.org \
--cc=yukuai@fygo.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®