Skip to content

Commit

Permalink
[SCSI] scsi_dh: Check for sdev state in store_dh_state()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hannes Reinecke authored and James Bottomley committed Aug 30, 2011
1 parent 46ccf6b commit 6bc8d2a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/scsi/device_handler/scsi_dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6bc8d2a

Please sign in to comment.