Skip to contentSkip to conversation

ata: libata-scsi: fix the INC_512 bit test for SECURITY PROTOCOL IN/OUT

PATCH Applied Niklas Cassel 2 participants 3 messages Nov 16 – Nov 17

Subsystems (2)
lore
Share & tools
lore

Niklas Cassel

author maintainer
#0 lore raw

PATCH 1/1 ata: libata-scsi: fix the INC_512 bit test for SECURITY PROTOCOL IN/OUT

ata_scsi_security_inout_xlat() tests the INC_512 bit with cdb[4] & 7. INC_512 is bit 7 of byte 4 of the SECURITY PROTOCOL IN and SECURITY PROTOCOL OUT CDBs (SPC-6, tables 280 and 282), and bits 6:0 of that byte are reserved.

Test bit 7 instead.

Fixes 818831c8b22f ("libata: implement SECURITY PROTOCOL IN/OUT")
---
 drivers/ata/libata-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-scsi.c +1 -1
index 87a57495d2e4..ae062fd23684 100644
@@ -4812,7 +4812,7 @@ static unsigned int ata_scsi_security_inout_xlat(struct ata_queued_cmd *qc)
 		return 1;
 	}
 
-	if (cdb[4] & 7) { /* INC_512 */
+	if (cdb[4] & 0x80) { /* INC_512 */
 		if (len > 0xffff) {
 			ata_scsi_set_invalid_field(qc->dev, scmd, 6, 0);
 			return 1;
Signature · 1 line
2.56.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Niklas Cassel

ata_scsi_security_inout_xlat() tests the INC_512 bit with cdb[4] & 7. INC_512 is bit 7 of byte 4 of the SECURITY PROTOCOL IN and SECURITY PROTOCOL OUT CDBs (SPC-6, tables 280 and 282), and bits 6:0 of that byte are reserved.

Test bit 7 instead.

Fixes 818831c8b22f ("libata: implement SECURITY PROTOCOL IN/OUT")
Signature · 2 lines
Damien Le Moal
Western Digital Research
author maintainer Applied
#2 lore raw
In reply to Niklas Cassel
Quoted 8 lines · Niklas Cassel

ata_scsi_security_inout_xlat() tests the INC_512 bit with cdb[4] & 7. INC_512 is bit 7 of byte 4 of the SECURITY PROTOCOL IN and SECURITY PROTOCOL OUT CDBs (SPC-6, tables 280 and 282), and bits 6:0 of that byte are reserved.

Test bit 7 instead.

[...]

Applied to libata/linux.git (for-7.4-fixes), thanks!

[1/1] ata: libata-scsi: fix the INC_512 bit test for SECURITY PROTOCOL IN/OUT

      https://git.kernel.org/libata/linux/c/e2954988

Kind regards,
Niklas