Two small things around sd_init() in 2.4.18-pre4

Pete Zaitcev (zaitcev@redhat.com)
Tue, 22 Jan 2002 00:48:57 -0500


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

--- linux-2.4.18-pre4/drivers/scsi/sd.c.0 Mon Jan 21 21:22:25 2002
+++ linux-2.4.18-pre4/drivers/scsi/sd.c Mon Jan 21 21:22:43 2002
@@ -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;
}
-
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/