Skip to contentSkip to conversation

fix libata inquiry VPD for ATAPI devices

PATCH New Tony Battersby 1 participant 1 message Dec 21, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix libata inquiry VPD for ATAPI devices

The following patch prevents libata from incorrectly modifying inquiry VPD pages and command support data from ATAPI devices. I have tested the patch with a SATA ATAPI tape drive on an AHCI controller.

Patch is against kernel 2.4.32 with 2.4.32-libata1.patch applied.

Anthony J. Battersby
Cybernetics

drivers/scsi/libata-scsi.c renamed from drivers/scsi/libata-scsi.c.orig +1 -4
@@ -2009,7 +2009,7 @@
 	else {
 		u8 *scsicmd = cmd->cmnd;
 
-		if (scsicmd[0] == INQUIRY) {
+		if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) {
 			u8 *buf = NULL;
 			unsigned int buflen;
 
@@ -2023,9 +2023,6 @@
 	 * device.  2) Ensure response data format / ATAPI information
 	 * are always correct.
 	 */
-	/* FIXME: do we ever override EVPD pages and the like, with
-	 * this code?
-	 */
 			if (buf[2] == 0) {
 				buf[2] = 0x5;
 				buf[3] = 0x32;