]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
md/raid1: Add check for missing source disk in process_checks()
authorMeir Elisha <meir.elisha@volumez.com>
Tue, 8 Apr 2025 14:38:08 +0000 (17:38 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:51:02 +0000 (07:51 +0200)
commit459098685edf611ef272b300da3376dfa75ade8e
treec1a941974ddb83b2174f57baa2e5603715dc7937
parent41866aa93d2ec8fd6cc24dbe9074c7928bf6a1f6
md/raid1: Add check for missing source disk in process_checks()

[ Upstream commit b7c178d9e57c8fd4238ff77263b877f6f16182ba ]

During recovery/check operations, the process_checks function loops
through available disks to find a 'primary' source with successfully
read data.

If no suitable source disk is found after checking all possibilities,
the 'primary' index will reach conf->raid_disks * 2. Add an explicit
check for this condition after the loop. If no source disk was found,
print an error message and return early to prevent further processing
without a valid primary source.

Link: https://lore.kernel.org/linux-raid/20250408143808.1026534-1-meir.elisha@volumez.com
Signed-off-by: Meir Elisha <meir.elisha@volumez.com>
Suggested-and-reviewed-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/raid1.c