Subject: [PATCH 1/2] scsi: core: Treat "Logical unit access not authorized" as permanent error

From: Kamil Kaminski

Date: Wed Feb 25 2026 - 18:14:07 EST


From 21dfa18035fb03b9c141550aeded92cf6d23473a Mon Sep 17 00:00:00 2001
From: Kamil Kaminski <kylek389@xxxxxxxxx>
Date: Wed, 25 Feb 2026 13:42:12 -0600
Subject: [PATCH 1/2] scsi: core: Treat "Logical unit access not authorized" as
 permanent error

SanDisk Extreme Portable SSD and similar hardware-encrypted USB drives
return Sense Key DATA_PROTECT (0x07) with ASC 0x74, ASCQ 0x71 ("Logical
unit access not authorized") when password-locked.

The SCSI error handler currently treats this as a generic DATA_PROTECT
error. While it eventually fails the command, the block layer continues
retrying operations, causing excessive I/O errors that saturate the USB
bus and crash xHCI controllers (kernel bug 216696).

Add special handling to return SUCCESS immediately for ASC 0x74/ASCQ
0x71, preventing SCSI-level retries and allowing the sd driver to
handle the condition gracefully.

Closes: https://bugzilla.kernel.org/show_bug.cgi?id=216696
Signed-off-by: Kamil Kaminski <kylek389@xxxxxxxxx>
---
 drivers/scsi/scsi_error.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 147127fb4db9..aceb7c55893b 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -692,6 +691,23 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd)

         /* these are not supported */
     case DATA_PROTECT:
+        /*
+         * ASC 0x74/ASCQ 0x71: "Logical unit access not authorized"
+         *
+         * This indicates a password-locked or hardware-encrypted device
+         * (e.g., SanDisk Extreme Portable SSD, WD My Passport) that
+         * requires vendor-specific unlock software.
+         *
+         * Unlike write protection, this is a security lock that cannot
+         * be cleared by the OS. Retrying causes USB bus saturation.
+         * Treat as permanent failure immediately.
+         */
+        if (sshdr.asc == 0x74 && sshdr.ascq == 0x71) {
+            sdev_printk(KERN_WARNING, scmd->device,
+                    "scsi: Logical unit access not authorized - device is password locked, treating as permanent error\n");
+            set_scsi_ml_byte(scmd, SCSIML_STAT_TGT_FAILURE);
+            return SUCCESS;
+        }
         if (sshdr.asc == 0x27 && sshdr.ascq == 0x07) {
             /* Thin provisioning hard threshold reached */
             set_scsi_ml_byte(scmd, SCSIML_STAT_NOSPC);
--
2.53.0