Skip to content

Commit

Permalink
cciss: Make cciss_seq_show handle holes in the h->drv[] array
Browse files Browse the repository at this point in the history
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."

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Cc: stable@kernel.org
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Stephen M. Cameron authored and Jens Axboe committed Feb 5, 2010
1 parent ae54abe commit 531c2dc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 531c2dc

Please sign in to comment.