summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2022-06-29 19:40:57 +0200
committerMike Snitzer <snitzer@kernel.org>2022-06-30 01:48:04 +0200
commit617b365872a247480e9dcd50a32c8d1806b21861 (patch)
tree6d09c8b83bf8c67a2979848541d0988be100dc69 /drivers/md/raid5.c
parentdm raid: fix KASAN warning in raid5_remove_disk (diff)
downloadlinux-617b365872a247480e9dcd50a32c8d1806b21861.tar.xz
linux-617b365872a247480e9dcd50a32c8d1806b21861.zip
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 '')
-rw-r--r--drivers/md/raid5.c1
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;