Skip to content

Commit

Permalink
scst_lib: Fix VPD inquiry handling on incorrect LUNs
Browse files Browse the repository at this point in the history
When SCST receives an INQUIRY request for an incorrect LUN, it calls
scst_set_lun_not_supported_inquiry(), which returns an inquiry buffer with
a peripheral qualifier of 011b and a peripheral device type of 1Fh.
However, for a VPD inquiry, it is unable to populate the remaining fields.
According to SPC-6, if the device server cannot return the requested data,
it should terminate with CHECK CONDITION.

Reported-by: Lev Vainblat <[email protected]>
  • Loading branch information
lnocturno committed Aug 19, 2024
1 parent 7117490 commit 0b00e0a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scst/src/scst_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2094,7 +2094,7 @@ int scst_set_cmd_error(struct scst_cmd *cmd, int key, int asc, int ascq)
if (cmd->cdb[0] == REQUEST_SENSE)
res = scst_set_lun_not_supported_request_sense(cmd,
key, asc, ascq);
else if (cmd->cdb[0] == INQUIRY)
else if (cmd->cdb[0] == INQUIRY && !(cmd->cdb[1] & 0x01/*EVPD*/))
res = scst_set_lun_not_supported_inquiry(cmd);
else if (cmd->cdb[0] == REPORT_LUNS)
res = scst_set_lun_not_supported_report_luns(cmd);
Expand Down

0 comments on commit 0b00e0a

Please sign in to comment.