aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2011-08-24 04:51:17 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-08-30 15:31:24 -0400
commit6bc8d2a0c6bb3e52f0c66e6cde6799d1b90b42ba (patch)
tree4cbd2d0447b7136ef30bd3460423853e9a02871c
parent46ccf6b55bfa9fff7d0a9da761f186e98cf2f660 (diff)
[SCSI] scsi_dh: Check for sdev state in store_dh_state()
Avoid attaching a hardware handler to a device which is already scheduled for deletion. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r--drivers/scsi/device_handler/scsi_dh.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh.c b/drivers/scsi/device_handler/scsi_dh.c
index 3ac71cf6b7f..7c05fd9dccf 100644
--- a/drivers/scsi/device_handler/scsi_dh.c
+++ b/drivers/scsi/device_handler/scsi_dh.c
@@ -190,6 +190,10 @@ store_dh_state(struct device *dev, struct device_attribute *attr,
190 struct scsi_device_handler *scsi_dh; 190 struct scsi_device_handler *scsi_dh;
191 int err = -EINVAL; 191 int err = -EINVAL;
192 192
193 if (sdev->sdev_state == SDEV_CANCEL ||
194 sdev->sdev_state == SDEV_DEL)
195 return -ENODEV;
196
193 if (!sdev->scsi_dh_data) { 197 if (!sdev->scsi_dh_data) {
194 /* 198 /*
195 * Attach to a device handler 199 * Attach to a device handler