aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2009-09-17 14:47:50 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-10-01 15:15:43 -0400
commit2c935593ac1871211b43a54f023dc3bc605ad346 (patch)
tree7ce33ec7a0f1bb7386a347ed1e31c7f2513ed5c2
parent2d11d9931f5968bddac50d9d224c4812d4be869a (diff)
cciss: Fix excessive gendisk freeing bug on driver unload.
Fix bug that free_hba was calling put_disk for all gendisk[] pointers -- all 1024 of them -- regardless of whether the were used or not (NULL). This bug could cause rmmod to oops if logical drives had been deleted during the driver's lifetime. Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--drivers/block/cciss.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 0a3c057c7785..3a6ca7de4c93 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3893,15 +3893,16 @@ Enomem:
3893 return -1; 3893 return -1;
3894} 3894}
3895 3895
3896static void free_hba(int i) 3896static void free_hba(int n)
3897{ 3897{
3898 ctlr_info_t *p = hba[i]; 3898 ctlr_info_t *h = hba[n];
3899 int n; 3899 int i;
3900 3900
3901 hba[i] = NULL; 3901 hba[n] = NULL;
3902 for (n = 0; n < CISS_MAX_LUN; n++) 3902 for (i = 0; i < h->highest_lun + 1; i++)
3903 put_disk(p->gendisk[n]); 3903 if (h->gendisk[i] != NULL)
3904 kfree(p); 3904 put_disk(h->gendisk[i]);
3905 kfree(h);
3905} 3906}
3906 3907
3907/* Send a message CDB to the firmware. */ 3908/* Send a message CDB to the firmware. */