diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index c40327ad6ad5..474cf6abefea 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -7722,6 +7722,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;