diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2022-06-29 20:40:57 +0300 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2022-06-30 02:48:04 +0300 |
commit | 617b365872a247480e9dcd50a32c8d1806b21861 (patch) | |
tree | 6d09c8b83bf8c67a2979848541d0988be100dc69 /drivers/md/raid5.c | |
parent | 1ebc2cec0b7dd8dad0812449110803bd875ac816 (diff) | |
download | linux-617b365872a247480e9dcd50a32c8d1806b21861.tar.xz |
dm raid: fix KASAN warning in raid5_add_disks
There's a KASAN warning in raid5_add_disk when running the LVM testsuite.
The warning happens in the test
lvconvert-raid-reshape-linear_to_raid6-single-type.sh. We fix the warning
by verifying that rdev->saved_raid_disk is within limits.
Cc: stable@vger.kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r-- | drivers/md/raid5.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index ba289411f26f..20e53b167f81 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -8065,6 +8065,7 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) */ if (rdev->saved_raid_disk >= 0 && rdev->saved_raid_disk >= first && + rdev->saved_raid_disk <= last && conf->disks[rdev->saved_raid_disk].rdev == NULL) first = rdev->saved_raid_disk; |