From 0b00e0af96674a9942021ebabfabadfc370b3e04 Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Mon, 19 Aug 2024 10:54:38 +0300 Subject: [PATCH] scst_lib: Fix VPD inquiry handling on incorrect LUNs 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 --- scst/src/scst_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index ba776beac..c9d60c7c8 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -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);