mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 10:11:38 -04:00
scsi: lpfc: Cleanup error exit paths in lpfc_fdmi_cmd() and associated messages
Error labels in lpfc_fdmi_cmd() accidentally return success status and can potentially leak memory. Change error exit path status to return a non-zero value using a common exit path for failure cases. The error path also frees allocated memory and provides logging. Signed-off-by: Justin Tee <justin.tee@broadcom.com> Link: https://patch.msgid.link/20260212213008.149873-8-justintee8345@gmail.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
f6bfb8d149
commit
6b0bcf4b64
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************
|
||||
* This file is part of the Emulex Linux Device Driver for *
|
||||
* Fibre Channel Host Bus Adapters. *
|
||||
* Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
|
||||
* Copyright (C) 2017-2026 Broadcom. All Rights Reserved. The term *
|
||||
* “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *
|
||||
* Copyright (C) 2004-2016 Emulex. All rights reserved. *
|
||||
* EMULEX and SLI are trademarks of Emulex. *
|
||||
@@ -2427,13 +2427,14 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
|
||||
|
||||
/* CGN is only for the physical port, no vports */
|
||||
if (lpfc_fdmi_cmd(vport, ndlp, cmd,
|
||||
LPFC_FDMI_VENDOR_ATTR_mi) == 0)
|
||||
LPFC_FDMI_VENDOR_ATTR_mi) == 0) {
|
||||
phba->link_flag |= LS_CT_VEN_RPA;
|
||||
lpfc_printf_log(phba, KERN_INFO,
|
||||
lpfc_printf_log(phba, KERN_INFO,
|
||||
LOG_DISCOVERY | LOG_ELS,
|
||||
"6458 Send MI FDMI:%x Flag x%x\n",
|
||||
phba->sli4_hba.pc_sli4_params.mi_ver,
|
||||
phba->link_flag);
|
||||
}
|
||||
} else {
|
||||
lpfc_printf_log(phba, KERN_INFO,
|
||||
LOG_DISCOVERY | LOG_ELS,
|
||||
@@ -3214,7 +3215,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
|
||||
struct lpfc_iocbq *rspiocb);
|
||||
|
||||
if (!ndlp)
|
||||
return 0;
|
||||
goto fdmi_cmd_exit;
|
||||
|
||||
cmpl = lpfc_cmpl_ct_disc_fdmi; /* called from discovery */
|
||||
|
||||
@@ -3320,7 +3321,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
|
||||
if (vport->port_type != LPFC_PHYSICAL_PORT) {
|
||||
ndlp = lpfc_findnode_did(phba->pport, FDMI_DID);
|
||||
if (!ndlp)
|
||||
return 0;
|
||||
goto fdmi_cmd_free_rspvirt;
|
||||
}
|
||||
fallthrough;
|
||||
case SLI_MGMT_RPA:
|
||||
@@ -3396,7 +3397,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
|
||||
if (vport->port_type != LPFC_PHYSICAL_PORT) {
|
||||
ndlp = lpfc_findnode_did(phba->pport, FDMI_DID);
|
||||
if (!ndlp)
|
||||
return 0;
|
||||
goto fdmi_cmd_free_rspvirt;
|
||||
}
|
||||
fallthrough;
|
||||
case SLI_MGMT_DPA:
|
||||
|
||||
Reference in New Issue
Block a user