Re: [PATCH v2] scsi: sg: report request-table problems when any status is set

From: Bart Van Assche

Date: Tue Jul 07 2026 - 13:08:33 EST


On 7/6/26 8:08 PM, raoxu wrote:
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.

Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>