Commit ed0c958e authored by Jason Yan's avatar Jason Yan Committed by Yang Yingliang
Browse files

scsi: core: Treat device offline as a failure

mainline inclusion
from mainline-v5.14-rc1
commit 1ee27534
category: bugfix
bugzilla: NA
CVE: NA

-----------------------------------------------

When a SCSI device is offline a MODE SENSE command will return a result
with only DID_NO_CONNECT set. In sd_read_write_protect_flag() only the
status byte of the result is checked. Despite a returned status of
DID_NO_CONNECT the command is considered successful and we read
sdkp->write_prot from a buffer containing garbage.

Modify scsi_status_is_good() to treat DID_NO_CONNECT as a failure case.

Link: https://lore.kernel.org/r/20210330114727.234467-1-yanaijie@huawei.com


Signed-off-by: default avatarJason Yan <yanaijie@huawei.com>

conflicts:
include/scsi/scsi.h

Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarJason Yan <yanaijie@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 62371e76
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment