[PATCH 04/17] net/nfp: fix coredump caused by firmware abnormal cleanup

Chaoyong He chaoyong.he at corigine.com
Mon Jun 24 03:57:10 CEST 2024


The logic of 'nfp_fw_setup()' consider both single-pf and multi-pf
firmware, but the abnormal firmware cleanup logic only consider multi-pf
firmware and try to write the heart beat value, which will cause
coredump when using the single-pf firmware.

Fixes: 8ba461d1eecc ("net/nfp: introduce keepalive mechanism for multiple PF")
Cc: peng.zhang at corigine.com
Cc: stable at dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Long Wu <long.wu at corigine.com>
Reviewed-by: Peng Zhang <peng.zhang at corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 9870b2dd33..9196d5d0a4 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -2335,9 +2335,11 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 	free(sym_tbl);
 fw_cleanup:
 	nfp_fw_unload(cpp);
-	nfp_net_keepalive_stop(&pf_dev->multi_pf);
-	nfp_net_keepalive_clear(pf_dev->multi_pf.beat_addr, pf_dev->multi_pf.function_id);
-	nfp_net_keepalive_uninit(&pf_dev->multi_pf);
+	if (pf_dev->multi_pf.enabled) {
+		nfp_net_keepalive_stop(&pf_dev->multi_pf);
+		nfp_net_keepalive_clear(pf_dev->multi_pf.beat_addr, pf_dev->multi_pf.function_id);
+		nfp_net_keepalive_uninit(&pf_dev->multi_pf);
+	}
 eth_table_cleanup:
 	free(nfp_eth_table);
 hwinfo_cleanup:
-- 
2.39.1



More information about the dev mailing list