From: Hannes Reinecke Date: Wed, 24 Aug 2011 08:51:17 +0000 (+0200) Subject: [SCSI] scsi_dh: Check for sdev state in store_dh_state() X-Git-Tag: upstream/snapshot3+hdmi~8885^2~110 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6bc8d2a0c6bb3e52f0c66e6cde6799d1b90b42ba;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git [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 Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/device_handler/scsi_dh.c b/drivers/scsi/device_handler/scsi_dh.c index 3ac71cf..7c05fd9 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, struct scsi_device_handler *scsi_dh; int err = -EINVAL; + if (sdev->sdev_state == SDEV_CANCEL || + sdev->sdev_state == SDEV_DEL) + return -ENODEV; + if (!sdev->scsi_dh_data) { /* * Attach to a device handler