]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: fix thunderdome segfault
authorDan Williams <dan.j.williams@intel.com>
Sat, 12 Dec 2009 20:57:25 +0000 (13:57 -0700)
committerDan Williams <dan.j.williams@intel.com>
Sat, 12 Dec 2009 20:57:25 +0000 (13:57 -0700)
disk_list_get() can return NULL if:
1/ A formerly missing disk is re-added
2/ The original array has not been rebuilt, so the family number of the
   missing disk still matches
3/ The metadata record of the in-sync disks are read before the missing
   disk

This will result in the missing disk not adding its own serial number to
the disk_list, only its truncated value will be present.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
super-intel.c

index 39a29857569516d7fb15a79934140cfc230904a6..2d5796fedd5196f08a4e09a806fcc457a5f81908 100644 (file)
@@ -2429,7 +2429,7 @@ imsm_thunderdome(struct intel_super **super_list, int len)
                        struct intel_disk *idisk;
 
                        idisk = disk_list_get(dl->serial, disk_list);
-                       if (is_spare(&idisk->disk) &&
+                       if (idisk && is_spare(&idisk->disk) &&
                            !is_failed(&idisk->disk) && !is_configured(&idisk->disk))
                                dl->index = -1;
                        else {