Thread (4 messages) 4 messages, 2 authors, 2022-07-26

Re: [PATCH] md-raid10: fix KASAN warning

From: Song Liu <song@kernel.org>
Date: 2022-07-26 17:17:53
Also in: dm-devel

On Tue, Jul 26, 2022 at 1:33 AM Mikulas Patocka [off-list ref] 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
quoted hunk ↗ jump to hunk
---
 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)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help