Skip to content

Commit 935d1d9

Browse files
author
Paul Ely
committed
scsi: lpfc: Check for hdwq null ptr when cleaning up lpfc_vport structure
JIRA: https://issues.redhat.com/browse/RHEL-103751 commit 6698796 Author: Justin Tee <justin.tee@broadcom.com> Date: Wed Jun 18 12:21:28 2025 -0700 scsi: lpfc: Check for hdwq null ptr when cleaning up lpfc_vport structure If a call to lpfc_sli4_read_rev() from lpfc_sli4_hba_setup() fails, the resultant cleanup routine lpfc_sli4_vport_delete_fcp_xri_aborted() may occur before sli4_hba.hdwqs are allocated. This may result in a null pointer dereference when attempting to take the abts_io_buf_list_lock for the first hardware queue. Fix by adding a null ptr check on phba->sli4_hba.hdwq and early return because this situation means there must have been an error during port initialization. Signed-off-by: Justin Tee <justin.tee@broadcom.com> Link: https://lore.kernel.org/r/20250618192138.124116-4-justintee8345@gmail.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Paul Ely <paely@redhat.com>
1 parent 0bacc04 commit 935d1d9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/scsi/lpfc/lpfc_scsi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,10 @@ lpfc_sli4_vport_delete_fcp_xri_aborted(struct lpfc_vport *vport)
390390
if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_FCP))
391391
return;
392392

393+
/* may be called before queues established if hba_setup fails */
394+
if (!phba->sli4_hba.hdwq)
395+
return;
396+
393397
spin_lock_irqsave(&phba->hbalock, iflag);
394398
for (idx = 0; idx < phba->cfg_hdw_queue; idx++) {
395399
qp = &phba->sli4_hba.hdwq[idx];

0 commit comments

Comments
 (0)