Linus (et al)

 There is a bug in the code which sets up the hash table for finding
 devices in a "linear" mode RAID array.
 If the last device is the same size as the smallest device, then
 hash table that is allocated to store pointers to devices is
 overflowed.
 This has manifested in a repeatable Oops at boot time for
 Roberto Ragusa <[EMAIL PROTECTED]>.

 I think it can be fixed simply by just removing the final
 "table->dev1 = NULL" as that is what causes the problem, and I don't
 think that it is ever necessary.

 However, this patch does a little more and tidies up the code a bit,
 in particular removing an exit from the middle of a loop (which
 should be avoided where possible).

 patch against 2.4.0-test12-pre8

NeilBrown

--- ./drivers/md/linear.c       2000/12/10 22:37:18     1.3
+++ ./drivers/md/linear.c       2000/12/10 22:38:14     1.4
@@ -84,21 +84,19 @@
                dev_info_t *disk = conf->disks + j;
 
                if (size < 0) {
-                       table->dev1 = disk;
-                       table++;
+                       table[-1].dev1 = disk;
                }
                size += disk->size;
 
-               while (size) {
+               while (size>0) {
                        table->dev0 = disk;
-                       size -= conf->smallest->size;
-                       if (size < 0)
-                               break;
                        table->dev1 = NULL;
+                       size -= conf->smallest->size;
                        table++;
                }
        }
-       table->dev1 = NULL;
+       if (table-conf->hash_table != nb_zone)
+               BUG();
 
        return 0;
 
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to [EMAIL PROTECTED]

Reply via email to