aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorMichael Reed <mdr@sgi.com>2010-09-20 12:20:22 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-10-07 18:16:28 -0400
commit1a03ae0f556a931aa3747b70e44b78308f5b0590 (patch)
treeb31139e3dcffb4a890f40e1b7b875569dcec80ce /drivers/scsi
parent43ca910a9c90566308f39f51ac03a55f94a5f83c (diff)
[SCSI] sd name space exhaustion causes system hang
Following a site power outage which re-enabled all the ports on my FC switches, my system subsequently booted with far too many luns! I had let it run hoping it would make multi-user. It didn't. :( It hung solid after exhausting the last sd device, sdzzz, and attempting to create sdaaaa and beyond. I was unable to get a dump. Discovered using a 2.6.32.13 based system. correct this by detecting when the last index is utilized and failing the sd probe of the device. Patch applies to scsi-misc-2.6. Signed-off-by: Michael Reed <mdr@sgi.com> Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/sd.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 0c4f89cfb7dc..50f1fe605303 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2288,11 +2288,10 @@ static void sd_probe_async(void *data, async_cookie_t cookie)
2288 index = sdkp->index; 2288 index = sdkp->index;
2289 dev = &sdp->sdev_gendev; 2289 dev = &sdp->sdev_gendev;
2290 2290
2291 if (index < SD_MAX_DISKS) { 2291 gd->major = sd_major((index & 0xf0) >> 4);
2292 gd->major = sd_major((index & 0xf0) >> 4); 2292 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
2293 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00); 2293 gd->minors = SD_MINORS;
2294 gd->minors = SD_MINORS; 2294
2295 }
2296 gd->fops = &sd_fops; 2295 gd->fops = &sd_fops;
2297 gd->private_data = &sdkp->driver; 2296 gd->private_data = &sdkp->driver;
2298 gd->queue = sdkp->device->request_queue; 2297 gd->queue = sdkp->device->request_queue;
@@ -2382,6 +2381,12 @@ static int sd_probe(struct device *dev)
2382 if (error) 2381 if (error)
2383 goto out_put; 2382 goto out_put;
2384 2383
2384 if (index >= SD_MAX_DISKS) {
2385 error = -ENODEV;
2386 sdev_printk(KERN_WARNING, sdp, "SCSI disk (sd) name space exhausted.\n");
2387 goto out_free_index;
2388 }
2389
2385 error = sd_format_disk_name("sd", index, gd->disk_name, DISK_NAME_LEN); 2390 error = sd_format_disk_name("sd", index, gd->disk_name, DISK_NAME_LEN);
2386 if (error) 2391 if (error)
2387 goto out_free_index; 2392 goto out_free_index;