Skip to content

Commit aad9945

Browse files
cp890582martinkpetersen
authored andcommitted
scsi: megaraid_sas: Block zero-length ATA VPD inquiry
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>
1 parent a63b69f commit aad9945

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_sdev_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;
@@ -3662,8 +3665,10 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
36623665

36633666
case MFI_STAT_SCSI_IO_FAILED:
36643667
case MFI_STAT_LD_INIT_IN_PROGRESS:
3665-
cmd->scmd->result =
3666-
(DID_ERROR << 16) | hdr->scsi_status;
3668+
if (hdr->scsi_status == 0xf0)
3669+
cmd->scmd->result = (DID_ERROR << 16) | SAM_STAT_CHECK_CONDITION;
3670+
else
3671+
cmd->scmd->result = (DID_ERROR << 16) | hdr->scsi_status;
36673672
break;
36683673

36693674
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)