Message ID | alpine.LRH.2.02.2207260431020.32515@file01.intranet.prod.int.rdu2.redhat.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Song Liu |
Headers | show |
Series | md-raid10: fix KASAN warning | expand |
On Tue, Jul 26, 2022 at 1:33 AM Mikulas Patocka <mpatocka@redhat.com> wrote: > > 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. > [...] > ffff889108f3d380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc > ffff889108f3d400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > > Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> > Cc: stable@vger.kernel.org Applied to md-next. Thanks! Song > > --- > drivers/md/raid10.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > Index: linux-2.6/drivers/md/raid10.c > =================================================================== > --- linux-2.6.orig/drivers/md/raid10.c 2022-07-13 19:05:50.000000000 +0200 > +++ linux-2.6/drivers/md/raid10.c 2022-07-13 19:07:05.000000000 +0200 > @@ -2167,9 +2167,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) >
Index: linux-2.6/drivers/md/raid10.c =================================================================== --- linux-2.6.orig/drivers/md/raid10.c 2022-07-13 19:05:50.000000000 +0200 +++ linux-2.6/drivers/md/raid10.c 2022-07-13 19:07:05.000000000 +0200 @@ -2167,9 +2167,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)