User: Password:
|
|
Subscribe / Log in / New account

[26/93] cciss: Make cciss_seq_show handle holes in the h->drv[] array

From:  Greg KH <gregkh-AT-suse.de>
To:  linux-kernel-AT-vger.kernel.org, stable-AT-kernel.org
Subject:  [26/93] cciss: Make cciss_seq_show handle holes in the h->drv[] array
Date:  Fri, 19 Feb 2010 08:29:19 -0800
Cc:  stable-review-AT-kernel.org, torvalds-AT-linux-foundation.org, akpm-AT-linux-foundation.org, alan-AT-lxorguk.ukuu.org.uk, "Stephen M. Cameron" <scameron-AT-beardog.cce.hp.com>, Jens Axboe <jens.axboe-AT-oracle.com>
Archive-link:  Article, Thread

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

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

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

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 <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

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

--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -339,6 +339,9 @@ static int cciss_seq_show(struct seq_fil
 	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;
 




(Log in to post comments)


Copyright © 2010, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds