Skip to content

Commit e46767d

Browse files
Chandrakanth Patilroot
authored andcommitted
scsi: megaraid_sas: Block zero-length ATA VPD inquiry
JIRA: https://issues.redhat.com/browse/RHEL-80700 A firmware bug was observed where ATA VPD inquiry commands with a zero-length data payload were not handled and failed with a non-standard status code of 0xf0. Avoid sending ATA VPD inquiry commands without data payload by setting the device no_vpd_size flag to 1. In addition, if the firmware returns a status code of 0xf0, set scsi_cmnd->result to CHECK_CONDITION to facilitate proper error handling. Suggested-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20250402193735.5098-1-chandrakanth.patil@broadcom.com Tested-by: Ryan Lahfa <ryan@lahfa.xyz> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> (cherry picked from commit aad9945) Signed-off-by: Chandrakanth Patil <chanpati@redhat.com>
1 parent 3129149 commit e46767d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

drivers/scsi/megaraid/megaraid_sas_base.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,6 +2103,9 @@ static int megasas_device_configure(struct scsi_device *sdev,
21032103
/* This sdev property may change post OCR */
21042104
megasas_set_dynamic_target_properties(sdev, lim, is_target_prop);
21052105

2106+
if (!MEGASAS_IS_LOGICAL(sdev))
2107+
sdev->no_vpd_size = 1;
2108+
21062109
mutex_unlock(&instance->reset_mutex);
21072110

21082111
return 0;
@@ -3660,8 +3663,10 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
36603663

36613664
case MFI_STAT_SCSI_IO_FAILED:
36623665
case MFI_STAT_LD_INIT_IN_PROGRESS:
3663-
cmd->scmd->result =
3664-
(DID_ERROR << 16) | hdr->scsi_status;
3666+
if (hdr->scsi_status == 0xf0)
3667+
cmd->scmd->result = (DID_ERROR << 16) | SAM_STAT_CHECK_CONDITION;
3668+
else
3669+
cmd->scmd->result = (DID_ERROR << 16) | hdr->scsi_status;
36653670
break;
36663671

36673672
case MFI_STAT_SCSI_DONE_WITH_ERROR:

drivers/scsi/megaraid/megaraid_sas_fusion.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,10 @@ map_cmd_status(struct fusion_context *fusion,
20432043

20442044
case MFI_STAT_SCSI_IO_FAILED:
20452045
case MFI_STAT_LD_INIT_IN_PROGRESS:
2046-
scmd->result = (DID_ERROR << 16) | ext_status;
2046+
if (ext_status == 0xf0)
2047+
scmd->result = (DID_ERROR << 16) | SAM_STAT_CHECK_CONDITION;
2048+
else
2049+
scmd->result = (DID_ERROR << 16) | ext_status;
20472050
break;
20482051

20492052
case MFI_STAT_SCSI_DONE_WITH_ERROR:

0 commit comments

Comments
 (0)