Skip to content

Commit 1d3a742

Browse files
Xu Raomartinkpetersen
authored andcommitted
scsi: sg: Report request-table problems when any status is set
SG_GET_REQUEST_TABLE reports per-request diagnostic state through sg_req_info::problem. The field is meant to indicate whether there is an error to report for a completed request. sg_fill_request_table() currently combines masked_status, host_status and driver_status with bitwise AND. This only reports a problem when all three status fields are non-zero at the same time. A normal target check condition, for example, has masked_status set while host_status and driver_status may both be zero, so the request is incorrectly reported as clean. Use the same condition as sg_new_read(), which sets SG_INFO_CHECK when any of the three status fields is non-zero. Cc: stable@vger.kernel.org Signed-off-by: Xu Rao <raoxu@uniontech.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Link: https://patch.msgid.link/54B60C19F7DB8889+20260707030845.970018-1-raoxu@uniontech.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 46aea2c commit 1d3a742

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

drivers/scsi/sg.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,10 +863,9 @@ sg_fill_request_table(Sg_fd *sfp, sg_req_info_t *rinfo)
863863
if (val >= SG_MAX_QUEUE)
864864
break;
865865
rinfo[val].req_state = srp->done + 1;
866-
rinfo[val].problem =
867-
srp->header.masked_status &
868-
srp->header.host_status &
869-
srp->header.driver_status;
866+
rinfo[val].problem = srp->header.masked_status ||
867+
srp->header.host_status ||
868+
srp->header.driver_status;
870869
if (srp->done)
871870
rinfo[val].duration =
872871
srp->header.duration;

0 commit comments

Comments
 (0)