[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220819104534.GA11901@duo.ucw.cz>
Date: Fri, 19 Aug 2022 12:45:34 +0200
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Mikulas Patocka <mpatocka@...hat.com>,
Song Liu <song@...nel.org>, Jens Axboe <axboe@...nel.dk>
Subject: Re: [PATCH 5.15 089/779] md-raid10: fix KASAN warning
Hi!
> From: Mikulas Patocka <mpatocka@...hat.com>
>
> commit d17f744e883b2f8d13cca252d71cfe8ace346f7d upstream.
>
> There's a KASAN warning in raid10_remove_disk when running the lvm
> test lvconvert-raid-reshape.sh. We fix this warning by verifying that the
> value "number" is valid.
>
> BUG: KASAN: slab-out-of-bounds in raid10_remove_disk+0x61/0x2a0 [raid10]
> Read of size 8 at addr ffff889108f3d300 by task mdX_raid10/124682
Is this place for array_index_nospec?
Best regards,
Pavel
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -2139,9 +2139,12 @@ static int raid10_remove_disk(struct mdd
> int err = 0;
> int number = rdev->raid_disk;
> struct md_rdev **rdevp;
> - struct raid10_info *p = conf->mirrors + number;
> + struct raid10_info *p;
>
> print_conf(conf);
> + if (unlikely(number >= mddev->raid_disks))
> + return 0;
> + p = conf->mirrors + number;
> if (rdev == p->rdev)
> rdevp = &p->rdev;
> else if (rdev == p->replacement)
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists