Skip to contentSkip to conversation

megaraid_sas: Block zero-length ATA VPD inquiry due to firmware bug

PATCH Applied Chandrakanth Patil 2 participants 3 messages Apr 2, 2025 – Apr 3, 2025

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

PATCH 1/2 megaraid_sas: Block zero-length ATA VPD inquiry due to firmware bug

There is a firmware bug where ATA VPD inquiry commands with zero data length are not handled and fail with a non-standard return status code 0xf0.

Hence, the driver blocks zero-length ATA VPD inquiry commands by setting the device no_vpd_size flag to 1. Additionally, if the firmware still returns status code 0xf0 in other failure scenarios, the driver converts it to a SCSI 'check condition' for proper OS handling.

---
 drivers/scsi/megaraid/megaraid_sas_base.c   | 9 +++++++--
 drivers/scsi/megaraid/megaraid_sas_fusion.c | 5 ++++-
 2 files changed, 11 insertions(+), 3 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +7 -2
index 28c75865967a..d793924547f8 100644
@@ -2103,6 +2103,9 @@ static int megasas_sdev_configure(struct scsi_device *sdev,
 	/* This sdev property may change post OCR */
 	megasas_set_dynamic_target_properties(sdev, lim, is_target_prop);
 
+	if (!MEGASAS_IS_LOGICAL(sdev))
+		sdev->no_vpd_size = 1;
+
 	mutex_unlock(&instance->reset_mutex);
 
 	return 0;
@@ -3662,8 +3665,10 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 
 		case MFI_STAT_SCSI_IO_FAILED:
 		case MFI_STAT_LD_INIT_IN_PROGRESS:
-			cmd->scmd->result =
-			    (DID_ERROR << 16) | hdr->scsi_status;
+			if (hdr->scsi_status == 0xf0)
+				cmd->scmd->result = (DID_ERROR << 16) | SAM_STAT_CHECK_CONDITION;
+			else
+				cmd->scmd->result = (DID_ERROR << 16) | hdr->scsi_status;
 			break;
 
 		case MFI_STAT_SCSI_DONE_WITH_ERROR:
drivers/scsi/megaraid/megaraid_sas_fusion.c +4 -1
index 1eec23da28e2..1eea4df9e47d 100644
@@ -2043,7 +2043,10 @@ map_cmd_status(struct fusion_context *fusion,
 
 	case MFI_STAT_SCSI_IO_FAILED:
 	case MFI_STAT_LD_INIT_IN_PROGRESS:
-		scmd->result = (DID_ERROR << 16) | ext_status;
+		if (ext_status == 0xf0)
+			scmd->result = (DID_ERROR << 16) | SAM_STAT_CHECK_CONDITION;
+		else
+			scmd->result = (DID_ERROR << 16) | ext_status;
 		break;
 
 	case MFI_STAT_SCSI_DONE_WITH_ERROR:
Signature · 1 line
2.39.1
#1 lore raw

PATCH 2/2 megaraid_sas: Driver version update to 07.734.00.00-rc1

---
 drivers/scsi/megaraid/megaraid_sas.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +2 -2
index 088cc40ae866..8ee2bfe47571 100644
@@ -23,8 +23,8 @@
 /*
  * MegaRAID SAS Driver meta data
  */
-#define MEGASAS_VERSION				"07.727.03.00-rc1"
-#define MEGASAS_RELDATE				"Oct 03, 2023"
+#define MEGASAS_VERSION				"07.734.00.00-rc1"
+#define MEGASAS_RELDATE				"Apr 03, 2025"
 
 #define MEGASAS_MSIX_NAME_LEN			32
 
Signature · 1 line
2.39.1
#2 lore raw
In reply to Chandrakanth Patil

Chandrakanth,

Quoted 3 lines

There is a firmware bug where ATA VPD inquiry commands with zero data length are not handled and fail with a non-standard return status code 0xf0.

Applied to 6.15/scsi-staging. Thanks for getting this fixed, much appreciated!

Signature · 1 line
Martin K. Petersen