Patch to sd.c in 2.4.16

From: Pete Zaitcev (zaitcev@redhat.com)
Date: Fri Nov 30 2001 - 17:48:00 EST


Hi, Marcelo (and the list):

Here's a patch that fixes kfree of static data in sd.c
(and bizzare ooses), also a modest cleanup. Please consider.
It's a fallout of one guy attaching 150 disks.

-- Pete

--- linux-2.4.16/drivers/scsi/sd.c Fri Nov 9 14:05:06 2001
+++ linux-2.4.16-niph/drivers/scsi/sd.c Thu Nov 29 19:25:22 2001
@@ -1157,8 +1157,6 @@
                         SCSI_DISKS_PER_MAJOR * sizeof *sd_gendisks[i].flags);
                 sd_gendisks[i].major = SD_MAJOR(i);
                 sd_gendisks[i].major_name = "sd";
- sd_gendisks[i].minor_shift = 4;
- sd_gendisks[i].max_p = 1 << 4;
                 sd_gendisks[i].part = sd + (i * SCSI_DISKS_PER_MAJOR << 4);
                 sd_gendisks[i].sizes = sd_sizes + (i * SCSI_DISKS_PER_MAJOR << 4);
                 sd_gendisks[i].nr_real = 0;
@@ -1175,7 +1173,8 @@
                 kfree(sd_gendisks[i].de_arr);
                 kfree(sd_gendisks[i].flags);
         }
- kfree(sd_gendisks);
+ if (sd_gendisks != &sd_gendisk)
+ kfree(sd_gendisks);
 cleanup_sd_gendisks:
         kfree(sd);
 cleanup_sd:
@@ -1305,8 +1304,8 @@
         }
         DEVICE_BUSY = 1;
 
- max_p = sd_gendisks->max_p;
- start = target << sd_gendisks->minor_shift;
+ max_p = sd_gendisk.max_p;
+ start = target << sd_gendisk.minor_shift;
 
         for (i = max_p - 1; i >= 0; i--) {
                 int index = start + i;
@@ -1365,7 +1364,6 @@
                         }
                         devfs_register_partitions (&SD_GENDISK (i),
                                                    SD_MINOR_NUMBER (start), 1);
- /* unregister_disk() */
                         dpnt->has_part_table = 0;
                         dpnt->device = NULL;
                         dpnt->capacity = 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Nov 30 2001 - 21:00:41 EST