[patch 14/21] cciss: fix problem that deleting multiple logicaldrives could cause a panic

From: Greg KH
Date: Mon Jan 12 2009 - 20:34:35 EST


2.6.27-stable review patch. If anyone has any objections, please let us know.

------------------

From: Stephen M. Cameron <scameron@xxxxxxxxxxxxxxxxxxxxxxx>

commit d8a0be6ab7ba1ffa43e7ea0dcdde3e8b68d4f762 upstream.

Fix problem that deleting multiple logical drives could cause a panic.

It fixes a panic which can be easily reproduced in the following way: Just
create several "arrays," each with multiple logical drives via hpacucli,
then delete the first array, and it will blow up in deregister_disk(), in
the call to get_host() when it tries to dig the hba pointer out of a NULL
queue pointer.

The problem has been present since my code to make rebuild_lun_table
behave better went in.

Signed-off-by: Stephen M. Cameron <scameron@xxxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Jens Axboe <jens.axboe@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/block/cciss.c | 5 +++++
1 file changed, 5 insertions(+)

--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1692,6 +1692,11 @@ static int rebuild_lun_table(ctlr_info_t
for (i = 0; i <= h->highest_lun; i++) {
int j;
drv_found = 0;
+
+ /* skip holes in the array from already deleted drives */
+ if (h->drv[i].raid_level == -1)
+ continue;
+
for (j = 0; j < num_luns; j++) {
memcpy(&lunid, &ld_buff->LUN[j][0], 4);
lunid = le32_to_cpu(lunid);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/