From: Paul Menzel <pmenzel@molgen.mpg.de>
To: Yu Kuai <yukuai@fnnas.com>
Cc: song@kernel.org, linux-raid@vger.kernel.org,
linux-kernel@vger.kernel.org, linan122@huawei.com,
xni@redhat.com, czhong@redhat.com
Subject: Re: [PATCH] md/raid0: fix NULL pointer dereference in create_strip_zones() for dm-raid
Date: Mon, 17 Nov 2025 17:57:07 +0100 [thread overview]
Message-ID: <fa88d3de-29ce-403a-a681-8cd35dca044b@molgen.mpg.de> (raw)
In-Reply-To: <20251116021816.107648-1-yukuai@fnnas.com>
Dear Kuai,
Thank you for your patch.
Am 16.11.25 um 03:18 schrieb Yu Kuai:
> Commit 2107457e31fa ("md/raid0: Move queue limit setup before r0conf
> initialization") dereference mddev->gendisk unconditionally, which is
> NULL for dm-raid.
>
> Fix this problem by reverting to old codes for dm-raid.
>
> Fixes: 2107457e31fa ("md/raid0: Move queue limit setup before r0conf initialization")
> Reported-and-tested-by: Changhui Zhong <czhong@redhat.com>
> Closes: https://lore.kernel.org/all/CAGVVp+VqVnvGeneUoTbYvBv2cw6GwQRrR3B-iQ-_9rVfyumoKA@mail.gmail.com/
> Signed-off-by: Yu Kuai <yukuai@fnnas.com>
> ---
> drivers/md/raid0.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
> index 47aee1b1d4d1..985c377356eb 100644
> --- a/drivers/md/raid0.c
> +++ b/drivers/md/raid0.c
> @@ -68,7 +68,10 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
> struct strip_zone *zone;
> int cnt;
> struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL);
> - unsigned int blksize = queue_logical_block_size(mddev->gendisk->queue);
> + unsigned int blksize = 512;
> +
> + if (!mddev_is_dm(mddev))
> + blksize = queue_logical_block_size(mddev->gendisk->queue);
>
> *private_conf = ERR_PTR(-ENOMEM);
> if (!conf)
> @@ -84,6 +87,10 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf)
> sector_div(sectors, mddev->chunk_sectors);
> rdev1->sectors = sectors * mddev->chunk_sectors;
>
> + if (mddev_is_dm(mddev))
> + blksize = max(blksize, queue_logical_block_size(
> + rdev1->bdev->bd_disk->queue));
> +
> rdev_for_each(rdev2, mddev) {
> pr_debug("md/raid0:%s: comparing %pg(%llu)"
> " with %pg(%llu)\n",
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Kind regards,
Paul
next prev parent reply other threads:[~2025-11-17 16:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-16 2:18 Yu Kuai
2025-11-17 0:36 ` Xiao Ni
2025-11-17 6:57 ` Li Nan
2025-11-17 16:57 ` Paul Menzel [this message]
2025-11-30 1:48 ` Yu Kuai
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=fa88d3de-29ce-403a-a681-8cd35dca044b@molgen.mpg.de \
--to=pmenzel@molgen.mpg.de \
--cc=czhong@redhat.com \
--cc=linan122@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--cc=xni@redhat.com \
--cc=yukuai@fnnas.com \
/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®