aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/device_handler
diff options
context:
space:
mode:
authorMoger, Babu <Babu.Moger@netapp.com>2011-10-26 14:29:38 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-10-31 05:10:36 -0400
commita18a920c70d48a8e4a2b750d8a183b3c1a4be514 (patch)
tree40fb0151f2de47d6232957f599c928654a2b4ef8 /drivers/scsi/device_handler
parenta0c124137a40fc22730ae87caf17e821f2dce1ed (diff)
[SCSI] scsi_dh: check queuedata pointer before proceeding further
This patch validates sdev pointer in scsi_dh_activate before proceeding further. Without this check we might see the panic as below. I have seen this panic multiple times.. Call trace: #0 [ffff88007d647b50] machine_kexec at ffffffff81020902 #1 [ffff88007d647ba0] crash_kexec at ffffffff810875b0 #2 [ffff88007d647c70] oops_end at ffffffff8139c650 #3 [ffff88007d647c90] __bad_area_nosemaphore at ffffffff8102dd15 #4 [ffff88007d647d50] page_fault at ffffffff8139b8cf [exception RIP: scsi_dh_activate+0x82] RIP: ffffffffa0041922 RSP: ffff88007d647e00 RFLAGS: 00010046 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00000000000093c5 RDX: 00000000000093c5 RSI: ffffffffa02e6640 RDI: ffff88007cc88988 RBP: 000000000000000f R8: ffff88007d646000 R9: 0000000000000000 R10: ffff880082293790 R11: 00000000ffffffff R12: ffff88007cc88988 R13: 0000000000000000 R14: 0000000000000286 R15: ffff880037b845e0 ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0000 #5 [ffff88007d647e38] run_workqueue at ffffffff81060268 #6 [ffff88007d647e78] worker_thread at ffffffff81060386 #7 [ffff88007d647ee8] kthread at ffffffff81064436 #8 [ffff88007d647f48] kernel_thread at ffffffff81003fba Signed-off-by: Babu Moger <babu.moger@netapp.com> Cc: stable@kernel.org Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/device_handler')
-rw-r--r--drivers/scsi/device_handler/scsi_dh.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh.c b/drivers/scsi/device_handler/scsi_dh.c
index 7c05fd9dccfd..339ea23a8675 100644
--- a/drivers/scsi/device_handler/scsi_dh.c
+++ b/drivers/scsi/device_handler/scsi_dh.c
@@ -441,7 +441,15 @@ int scsi_dh_activate(struct request_queue *q, activate_complete fn, void *data)
441 441
442 spin_lock_irqsave(q->queue_lock, flags); 442 spin_lock_irqsave(q->queue_lock, flags);
443 sdev = q->queuedata; 443 sdev = q->queuedata;
444 if (sdev && sdev->scsi_dh_data) 444 if (!sdev) {
445 spin_unlock_irqrestore(q->queue_lock, flags);
446 err = SCSI_DH_NOSYS;
447 if (fn)
448 fn(data, err);
449 return err;
450 }
451
452 if (sdev->scsi_dh_data)
445 scsi_dh = sdev->scsi_dh_data->scsi_dh; 453 scsi_dh = sdev->scsi_dh_data->scsi_dh;
446 dev = get_device(&sdev->sdev_gendev); 454 dev = get_device(&sdev->sdev_gendev);
447 if (!scsi_dh || !dev || 455 if (!scsi_dh || !dev ||