From: sashiko-bot@kernel.org
To: "Jack Wang" <jinpu.wang@ionos.com>
Cc: yukuai@fygo.io, linux-raid@vger.kernel.org
Subject: Re: [PATCH v2 1/8] md: pass a queue_limits down to ->hot_add_disk()
Date: Thu, 10 Sep 2026 08:31:45 +0000 [thread overview]
Message-ID: <20260910083145.AD0921F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260910081114.1605746-2-jinpu.wang@ionos.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] raid1_add_disk fails to stack limits or validate compatibility for replacement disks.
--
commit d7876b523180e9507873b141ec81e8cdf84d9929
Author: Jack Wang <jinpu.wang@cloud.ionos.com>
md: pass a queue_limits down to ->hot_add_disk()
This commit updates the md hot-add disk paths to accept a queue_limits
argument. This allows callers to manage the limits lock explicitly when
adding a disk, preventing potential deadlocks.
[ ... ]
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -1923,7 +1924,12 @@ static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev)
> for (mirror = first; mirror <= last; mirror++) {
> p = conf->mirrors + mirror;
> if (!p->rdev) {
> - err = mddev_stack_new_rdev(mddev, rdev);
> + if (lim == MDDEV_STACK_SKIP)
> + err = 0;
> + else if (lim)
> + err = mddev_stack_rdev_into(mddev, rdev, lim);
> + else
> + err = mddev_stack_new_rdev(mddev, rdev);
> if (err)
> return err;
[ ... ]
> if (test_bit(WantReplacement, &p->rdev->flags) &&
> p[conf->raid_disks].rdev == NULL && repl_slot < 0)
> repl_slot = mirror;
> }
>
> if (err && repl_slot >= 0) {
> /* Add this device as a replacement */
> clear_bit(In_sync, &rdev->flags);
> set_bit(Replacement, &rdev->flags);
> raid1_add_conf(conf, rdev, repl_slot, true);
> err = 0;
> conf->fullsync = 1;
> }
[Severity: High]
This is a pre-existing issue, but does this replacement path in
raid1_add_disk() omit queue limits validation?
Unlike the primary hot-add path modified above, the fallback block for
configuring replacement disks skips the queue limits stacking entirely.
If a replacement disk is hot-added with incompatible features, such as
a larger logical block size or an unsupported integrity profile, it
appears the array will accept the disk without validation.
Could this allow the queue limits API contract to be bypassed,
potentially leading to misaligned I/Os being sent to the underlying
block device and resulting in I/O errors or data corruption during array
reconstruction?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910081114.1605746-1-jinpu.wang@ionos.com?part=1
next prev parent reply other threads:[~2026-09-10 8:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 8:11 [PATCH v2 0/8] md: don't wait for q->limits_lock while md holds back I/O Jack Wang
2026-09-10 8:11 ` [PATCH v2 1/8] md: pass a queue_limits down to ->hot_add_disk() Jack Wang
2026-09-10 8:31 ` sashiko-bot [this message]
2026-09-11 10:46 ` Nilay Shroff
2026-09-10 8:11 ` [PATCH v2 2/8] md: don't wait for q->limits_lock in check_sb_changes() Jack Wang
2026-09-10 8:36 ` sashiko-bot
2026-09-10 8:11 ` [PATCH v2 3/8] md: pass a queue_limits through the rdev sysfs stores Jack Wang
2026-09-10 8:11 ` [PATCH v2 4/8] md: defer the io_opt update out of the sync thread Jack Wang
2026-09-10 8:37 ` sashiko-bot
2026-09-10 8:11 ` [PATCH v2 5/8] md: take q->limits_lock before locking and suspending the array Jack Wang
2026-09-10 8:51 ` sashiko-bot
2026-09-10 8:11 ` [PATCH v2 6/8] md: pass a queue_limits through ->run() Jack Wang
2026-09-10 8:49 ` sashiko-bot
2026-09-11 10:54 ` Nilay Shroff
2026-09-10 8:11 ` [PATCH v2 7/8] md: open new legs before locking the array Jack Wang
2026-09-10 8:48 ` sashiko-bot
2026-09-10 8:11 ` [PATCH v2 8/8] md: link a new leg's holder " Jack Wang
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=20260910083145.AD0921F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jinpu.wang@ionos.com \
--cc=linux-raid@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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