grub2 upstream needs some fixes to accept spare disks in raid arrays.
the attached modifications in 'grub-core/drive/raid.c' stopped the
segmentation faults on my machine.
=== modified file 'grub-core/disk/raid.c'
--- grub-core/disk/raid.c 2010-09-13 21:59:22 +0000
+++ grub-core/disk/raid.c 2010-09-25 05:59:45 +0000
@@ -501,7 +501,8 @@
grub_dprintf ("raid", "array->nr_devs > array->total_devs (%d)?!?",
array->total_devs);
- if (array->device[new_array->index] != NULL)
+ if ((new_array->index < GRUB_RAID_MAX_DEVICES) &&
+ (array->device[new_array->index] != NULL))
/* We found multiple devices with the same number. Again,
this shouldn't happen. */
grub_dprintf ("raid", "Found two disks with the number %d?!?",
@@ -609,8 +610,13 @@
}
/* Add the device to the array. */
- array->device[new_array->index] = disk;
- array->start_sector[new_array->index] = start_sector;
+
+ /* ignore spare disks and more then GRUB_RAID_MAX_DEVICES */
+ if (new_array->index < GRUB_RAID_MAX_DEVICES)
+ {
+ array->device[new_array->index] = disk;
+ array->start_sector[new_array->index] = start_sector;
+ }
array->nr_devs++;
return 0;