From: Stephen M. Cameron Date: Fri, 5 Feb 2010 12:14:04 +0000 (+0100) Subject: cciss: Make cciss_seq_show handle holes in the h->drv[] array X-Git-Tag: firefly_0821_release~11625^2~67 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2b8fcd4ed0db58421d1600ff6e3b01dd68b3ef83;p=firefly-linux-kernel-4.4.55.git cciss: Make cciss_seq_show handle holes in the h->drv[] array commit 531c2dc70d339c5dfa8c3eb628c3459dc6f3a075 upstream. 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 Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 92b126394fa1..ca9c54870f29 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -339,6 +339,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;