scsi: sd: Fix sd_done() sense handling condition

Only enter the sense_key switch when the command returned CHECK
CONDITION with valid, non-deferred sense. The old condition let deferred
or invalid sense fall through and mis-handle the I/O.

Fixes: 03aba2f795 ("[SCSI] sd/scsi_lib simplify sd_rw_intr and scsi_io_completion")
Reviewed-by: Damien Le Moal <[email protected]>
Signed-off-by: Yang Xiuwei <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Martin K. Petersen (Oracle) <[email protected]>
This commit is contained in:
Yang Xiuwei authored and Martin K. Petersen (Oracle) committed 2026-08-07 13:13:17 -04:00
1 parent bb31844d88
commit a640d4546b
1 file changed
+2 -2
+2 -2
View File
@@ -2419,8 +2419,8 @@ static int sd_done(struct scsi_cmnd *SCpnt)
}
sdkp->medium_access_timed_out = 0;
if (!scsi_status_is_check_condition(result) &&
(!sense_valid || sense_deferred))
if (!scsi_status_is_check_condition(result) ||
!sense_valid || sense_deferred)
goto out;
switch (sshdr.sense_key) {