Commit 2c935593 authored by Stephen M. Cameron's avatar Stephen M. Cameron Committed by Jens Axboe

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: default avatarStephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 2d11d993
...@@ -3893,15 +3893,16 @@ static int alloc_cciss_hba(void) ...@@ -3893,15 +3893,16 @@ static int alloc_cciss_hba(void)
return -1; return -1;
} }
static void free_hba(int i) static void free_hba(int n)
{ {
ctlr_info_t *p = hba[i]; ctlr_info_t *h = hba[n];
int n; int i;
hba[i] = NULL; hba[n] = NULL;
for (n = 0; n < CISS_MAX_LUN; n++) for (i = 0; i < h->highest_lun + 1; i++)
put_disk(p->gendisk[n]); if (h->gendisk[i] != NULL)
kfree(p); put_disk(h->gendisk[i]);
kfree(h);
} }
/* Send a message CDB to the firmware. */ /* Send a message CDB to the firmware. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment