From: Bart Van Assche <bvanassche@acm.org>
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,
Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH] md: Fix an unlock in an error path of lbs_store()
Date: Mon, 26 Oct 2026 12:57:12 -0700 [thread overview]
Message-ID: <9dd41992e8b2d4bd63f74a245d34fa7850529bed.1793044632.git.bvanassche@acm.org> (raw)
If mddev_lock() fails, lbs_store() calls mddev_unlock() although the
reconfig_mutex is not held. Fix this by returning the mddev_lock() error
code directly. This bug has been detected by the Clang thread-safety
analyzer.
Fixes: 62ed1b582246 ("md: allow configuring logical block size")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
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 ac03b99f6428..7ce527073be9 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -6049,11 +6049,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;
}
reply other threads:[~2026-10-26 19:57 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=9dd41992e8b2d4bd63f74a245d34fa7850529bed.1793044632.git.bvanassche@acm.org \
--to=bvanassche@acm.org \
--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®