diff options
| author | Mike Christie <michael.christie@oracle.com> | 2021-11-20 10:49:17 -0600 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-12-01 09:23:33 +0100 |
| commit | 7854de57be29c69f42240b64d867cb19b117e16e (patch) | |
| tree | bbdf20cb6e6befd20582f0ae9f0a33ae3fb48d1a | |
| parent | 67a6f64a0c847a0927fb91d96abb03b3b0521394 (diff) | |
| download | linux-7854de57be29c69f42240b64d867cb19b117e16e.tar.gz linux-7854de57be29c69f42240b64d867cb19b117e16e.tar.bz2 linux-7854de57be29c69f42240b64d867cb19b117e16e.zip | |
scsi: core: sysfs: Fix setting device state to SDEV_RUNNING
[ Upstream commit eb97545d6264b341b06ba7603f52ff6c0b2af6ea ]
This fixes an issue added in commit 4edd8cd4e86d ("scsi: core: sysfs: Fix
hang when device state is set via sysfs") where if userspace is requesting
to set the device state to SDEV_RUNNING when the state is already
SDEV_RUNNING, we return -EINVAL instead of count. The commmit above set ret
to count for this case, when it should have set it to 0.
Link: https://lore.kernel.org/r/20211120164917.4924-1-michael.christie@oracle.com
Fixes: 4edd8cd4e86d ("scsi: core: sysfs: Fix hang when device state is set via sysfs")
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | drivers/scsi/scsi_sysfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 16432d42a50a..6faf1d6451b0 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -796,7 +796,7 @@ store_state_field(struct device *dev, struct device_attribute *attr, mutex_lock(&sdev->state_mutex); if (sdev->sdev_state == SDEV_RUNNING && state == SDEV_RUNNING) { - ret = count; + ret = 0; } else { ret = scsi_device_set_state(sdev, state); if (ret == 0 && state == SDEV_RUNNING) |
