All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] segfault in grub-probe when spare or faulty disks are found
@ 2010-09-27 20:32 Martin Schitter
  2010-09-28 20:24 ` Vladimir 'φ-coder/phcoder' Serbinenko
  2010-10-26  8:58 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 2 replies; 7+ messages in thread
From: Martin Schitter @ 2010-09-27 20:32 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 355 bytes --]

the actual raid implementation doesn't handle spare or faulty drives in 
a linux software raid array in a sane way. grub-probe will reproducible 
crash in such a setup.

please include the attached trivial patch to fix this problem.

for more information see:

https://savannah.gnu.org/bugs/?31119
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593652


[-- Attachment #2: grub2-raid-better.diff --]
[-- Type: text/x-patch, Size: 1094 bytes --]

=== 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 22:20:29 +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,9 +610,14 @@
     }
 
   /* Add the device to the array. */
-  array->device[new_array->index] = disk;
-  array->start_sector[new_array->index] = start_sector;
-  array->nr_devs++;
+
+  /* ignore spare/faulty 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;
 }


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-10-26 15:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-27 20:32 [PATCH] segfault in grub-probe when spare or faulty disks are found Martin Schitter
2010-09-28 20:24 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-09-29 12:16   ` Martin Schitter
2010-10-25 11:07   ` Martin Schitter
2010-10-25 11:11     ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-10-26  8:58 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-10-26 15:29   ` Martin Schitter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.