]> git.baikalelectronics.ru Git - kernel.git/commitdiff
dm raid: fix address sanitizer warning in raid_resume
authorMikulas Patocka <mpatocka@redhat.com>
Sun, 24 Jul 2022 18:33:52 +0000 (14:33 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:24:26 +0000 (14:24 +0200)
[ Upstream commit d59d1ab9b4c02b705755e27fef5b5468af29067c ]

There is a KASAN warning in raid_resume when running the lvm test
lvconvert-raid.sh. The reason for the warning is that mddev->raid_disks
is greater than rs->raid_disks, so the loop touches one entry beyond
the allocated length.

Cc: stable@vger.kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/dm-raid.c

index 5f7e40c48e47182702b4540c2f39ee710864aff7..eba277bb8a1f182c8d8514b2fe4475d8e4331286 100644 (file)
@@ -3824,7 +3824,7 @@ static void attempt_restore_of_faulty_devices(struct raid_set *rs)
 
        memset(cleared_failed_devices, 0, sizeof(cleared_failed_devices));
 
-       for (i = 0; i < mddev->raid_disks; i++) {
+       for (i = 0; i < rs->raid_disks; i++) {
                r = &rs->dev[i].rdev;
                /* HM FIXME: enhance journal device recovery processing */
                if (test_bit(Journal, &r->flags))