]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: core: Treat device offline as a failure
authorJason Yan <yanaijie@huawei.com>
Tue, 30 Mar 2021 11:47:27 +0000 (19:47 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 10 May 2021 17:24:03 +0000 (13:24 -0400)
commit64cb644f571887e235e5bc327f486c1801e2f512
tree93585d8287ed504d2129b25e1c2588955dcebaf2
parent78f0a5f86683713bf30eae653c023ab078a37264
scsi: core: Treat device offline as a failure

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: Jason Yan <yanaijie@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
include/scsi/scsi.h