diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2022-06-29 20:40:57 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-07 18:53:24 +0300 |
commit | d5b06039b195d4b6f94f5d345b1e4ac1975a9832 (patch) | |
tree | 8c8d9bc44eca4c3a25d3901fc1a9b705ef9fc802 /drivers/md | |
parent | 6352b2f4d8e95ec0ae576d7705435d64cfa29503 (diff) | |
download | linux-d5b06039b195d4b6f94f5d345b1e4ac1975a9832.tar.xz |
dm raid: fix KASAN warning in raid5_add_disks
commit 617b365872a247480e9dcd50a32c8d1806b21861 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md')
-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 e54d802ee0bb..b58984ddca13 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -8026,6 +8026,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; |