Re: [PATCH 1/1] scsi: Fix setting device state to running

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/20/21 8:49 AM, Mike Christie wrote:
> 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.
> 
> Fixes: 4edd8cd4e86d ("scsi: core: sysfs: Fix hang when device state is set
> via sysfs")
> Signed-off-by: Mike Christie <michael.christie@xxxxxxxxxx>
> 
> ---
>  drivers/scsi/scsi_sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index 7afcec250f9b..d4edce930a4a 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -812,7 +812,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)
> 

Reviewed-by: Lee Duncan <lduncan@xxxxxxxx>




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux