mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "yu kuai" <yukuai@fygo.io>
To: "Bart Van Assche" <bvanassche@acm.org>,
	"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>
Subject: Re: [PATCH] md: Fix an unlock in an error path of lbs_store()
Date: Tue, 3 Nov 2026 10:23:39 +0800	[thread overview]
Message-ID: <cfc6e703-70cc-4f63-9fb1-875cb6cc4b1d@fygo.io> (raw)
In-Reply-To: <9dd41992e8b2d4bd63f74a245d34fa7850529bed.1793044632.git.bvanassche@acm.org>

Hi,

在 2026/10/27 3:57, Bart Van Assche 写道:
> 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(-)

This problem is already fixed:

[PATCH] md: fix mddev_unlock() called without holding lock in 
lbs_store() - Jack Wang <https://lore.kernel.org/all/20260920103705.23191-1-jinpu.wang@ionos.com/>

>
> 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;
>   }

-- 
Thanks,
Kuai

      reply	other threads:[~2026-11-03  2:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 19:57 Bart Van Assche
2026-11-03  2:23 ` yu kuai [this message]

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=cfc6e703-70cc-4f63-9fb1-875cb6cc4b1d@fygo.io \
    --to=yukuai@fygo.io \
    --cc=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 \
    /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®