Skip to contentSkip to conversation

cciss: Make cciss_seq_show handle holes in the h->drv[] array.

PATCH In review Stephen M. Cameron 2 participants 2 messages Feb 4, 2010 – Feb 5, 2010 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cciss: Make cciss_seq_show handle holes in the h->drv[] array.

From: Stephen M. Cameron <[email protected]>

cciss: Make cciss_seq_show handle holes in the h->drv[] array. It is possible (and expected) for there to be holes in the h->drv[] array, that is, some elements may be NULL pointers. cciss_seq_show needs to be made aware of this possibility to avoid an Oops.

To reproduce the Oops which this fixes:

1) Create two "arrays" in the Array Configuratino Utility and several logical drives on each array.
2) cat /proc/driver/cciss/cciss* in an infinite loop
3) delete some of the logical drives in the first "array."

---
 drivers/block/cciss.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/block/cciss.c +3 -0
index 873e594..9291614 100644
@@ -337,6 +337,9 @@ static int cciss_seq_show(struct seq_file *seq, void *v)
 	if (*pos > h->highest_lun)
 		return 0;
 
+	if (drv == NULL) /* it's possible for h->drv[] to have holes. */
+		return 0;
+
 	if (drv->heads == 0)
 		return 0;
 
#1 lore raw
Quoted 7 lines · Stephen M. Cameron

From: Stephen M. Cameron <[email protected]>

cciss: Make cciss_seq_show handle holes in the h->drv[] array. It is possible (and expected) for there to be holes in the h->drv[] array, that is, some elements may be NULL pointers. cciss_seq_show needs to be made aware of this possibility to avoid an Oops.

Quoted 8 lines

To reproduce the Oops which this fixes:

1) Create two "arrays" in the Array Configuratino Utility and several logical drives on each array.
2) cat /proc/driver/cciss/cciss* in an infinite loop
3) delete some of the logical drives in the first "array."

Thanks Stephen, applied for 2.6.33. BTW, you want to put that stable cc into the patch itself as well, then it'll get picked up automatically when Linus merges it.

Signature · 1 line
Jens Axboe