patch 'net/fm10k: fix cleanup during init failure' has been queued to stable release 23.11.2
Xueming Li
xuemingl at nvidia.com
Fri Jul 12 12:44:47 CEST 2024
Hi,
FYI, your patch has been queued to stable release 23.11.2
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/14/24. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging
This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=eaaa1b29af82f97553af84a14190b0b2885ece21
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From eaaa1b29af82f97553af84a14190b0b2885ece21 Mon Sep 17 00:00:00 2001
From: Julien Meunier <julien.meunier at nokia.com>
Date: Wed, 3 Apr 2024 13:55:41 +0200
Subject: [PATCH] net/fm10k: fix cleanup during init failure
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit cd7f5da2e7d647863a3d6552b6787f413bbd05f2 ]
Cleanup was not done on this PMD if a error is seen during the init:
- possible memory leak due to a missing free
- interrupt handler was not disabled: if an IRQ is received after the
init, a SIGSEGV can be seen (private data stored in
rte_eth_devices[port_id] is pointing to NULL)
Fixes: a6061d9e7075 ("fm10k: register PF driver")
Fixes: 4c287332c39a ("fm10k: add PF and VF interrupt handling")
Signed-off-by: Julien Meunier <julien.meunier at nokia.com>
Reviewed-by: Bruce Richardson <bruce.richardson at intel.com>
---
drivers/net/fm10k/fm10k_ethdev.c | 39 +++++++++++++++++++++++++++-----
1 file changed, 33 insertions(+), 6 deletions(-)
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 4d3c4c10cf..cc2012786d 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3057,7 +3057,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
struct rte_intr_handle *intr_handle = pdev->intr_handle;
- int diag, i;
+ int diag, i, ret;
struct fm10k_macvlan_filter_info *macvlan;
PMD_INIT_FUNC_TRACE();
@@ -3146,21 +3146,24 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
diag = fm10k_stats_reset(dev);
if (diag != 0) {
PMD_INIT_LOG(ERR, "Stats reset failed: %d", diag);
- return diag;
+ ret = diag;
+ goto err_stat;
}
/* Reset the hw */
diag = fm10k_reset_hw(hw);
if (diag != FM10K_SUCCESS) {
PMD_INIT_LOG(ERR, "Hardware reset failed: %d", diag);
- return -EIO;
+ ret = -EIO;
+ goto err_reset_hw;
}
/* Setup mailbox service */
diag = fm10k_setup_mbx_service(hw);
if (diag != FM10K_SUCCESS) {
PMD_INIT_LOG(ERR, "Failed to setup mailbox: %d", diag);
- return -EIO;
+ ret = -EIO;
+ goto err_mbx;
}
/*PF/VF has different interrupt handling mechanism */
@@ -3199,7 +3202,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
if (switch_ready == false) {
PMD_INIT_LOG(ERR, "switch is not ready");
- return -1;
+ ret = -1;
+ goto err_switch_ready;
}
}
@@ -3234,7 +3238,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
if (!hw->mac.default_vid) {
PMD_INIT_LOG(ERR, "default VID is not ready");
- return -1;
+ ret = -1;
+ goto err_vid;
}
}
@@ -3243,6 +3248,28 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
MAIN_VSI_POOL_NUMBER);
return 0;
+
+err_vid:
+err_switch_ready:
+ rte_intr_disable(intr_handle);
+
+ if (hw->mac.type == fm10k_mac_pf) {
+ fm10k_dev_disable_intr_pf(dev);
+ rte_intr_callback_unregister(intr_handle,
+ fm10k_dev_interrupt_handler_pf, (void *)dev);
+ } else {
+ fm10k_dev_disable_intr_vf(dev);
+ rte_intr_callback_unregister(intr_handle,
+ fm10k_dev_interrupt_handler_vf, (void *)dev);
+ }
+
+err_mbx:
+err_reset_hw:
+err_stat:
+ rte_free(dev->data->mac_addrs);
+ dev->data->mac_addrs = NULL;
+
+ return ret;
}
static int
--
2.34.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2024-07-12 18:40:16.949536886 +0800
+++ 0061-net-fm10k-fix-cleanup-during-init-failure.patch 2024-07-12 18:40:14.136594223 +0800
@@ -1 +1 @@
-From cd7f5da2e7d647863a3d6552b6787f413bbd05f2 Mon Sep 17 00:00:00 2001
+From eaaa1b29af82f97553af84a14190b0b2885ece21 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit cd7f5da2e7d647863a3d6552b6787f413bbd05f2 ]
@@ -14 +16,0 @@
-Cc: stable at dpdk.org
@@ -23 +25 @@
-index fa0d16277e..7b490bea17 100644
+index 4d3c4c10cf..cc2012786d 100644
@@ -26 +28 @@
-@@ -3058,7 +3058,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
+@@ -3057,7 +3057,7 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
@@ -35 +37 @@
-@@ -3147,21 +3147,24 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
+@@ -3146,21 +3146,24 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
@@ -63 +65 @@
-@@ -3200,7 +3203,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
+@@ -3199,7 +3202,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
@@ -73 +75 @@
-@@ -3235,7 +3239,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
+@@ -3234,7 +3238,8 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
@@ -83 +85 @@
-@@ -3244,6 +3249,28 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
+@@ -3243,6 +3248,28 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
More information about the stable
mailing list