Skip to contentSkip to conversation

Two small things around sd_init() in 2.4.18-pre4

PATCH Pete Zaitcev 1 participant 1 message Jan 22, 2002 SCSI

lore
Share & tools
lore
#0 lore raw

Guys & gals:

Recenly, Marcelo took my bugfix for ->init() failure recovery. When I worked on it, I noticed two small unrelated thinkos which I'd like someone to verify.

1. It seems that sd_gendisks[i].de_arr and sd_gendisks[i].flags are never freed, thus rmmod leaks.

2. The sd.c sets blksize_size and clears blk_size, which looks dubious.

Are these two bugs or not?

Cheers,
-- Pete

drivers/scsi/sd.c renamed from drivers/scsi/sd.c.0 +5 -1
@@ -1412,10 +1412,14 @@
 		kfree(sd_blocksizes);
 		kfree(sd_hardsizes);
 		kfree((char *) sd);
+		for (i = 0; i < N_USED_SD_MAJORS; i++) {
+			kfree(sd_gendisks[i].de_arr);
+			kfree(sd_gendisks[i].flags);
+		}
 	}
 	for (i = 0; i < N_USED_SD_MAJORS; i++) {
 		del_gendisk(&sd_gendisks[i]);
-		blk_size[SD_MAJOR(i)] = NULL;
+		blksize_size[SD_MAJOR(i)] = NULL;
 		hardsect_size[SD_MAJOR(i)] = NULL;
 		read_ahead[SD_MAJOR(i)] = 0;
 	}