[PATCH v2 6/9] net/ixgbe: fix security context leak on init failure

Anurag Mandal anurag.mandal at intel.com
Tue Dec 1 11:55:17 CET 2026


ixgbe_ipsec_ctx_create() stores the newly allocated
security context in the device before registering the
security dynamic mbuf field.
If that registration fails, eth_ixgbe_dev_init()
returns without freeing the context, and
rte_eth_dev_release_port() does not free it either.

Go through the existing error path, which frees the context.

Fixes: 614af7548968 ("security: switch metadata to dynamic mbuf field")
Cc: stable at dpdk.org

Signed-off-by: Anurag Mandal <anurag.mandal at intel.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 drivers/net/intel/ixgbe/ixgbe_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/intel/ixgbe/ixgbe_ethdev.c b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
index 8b1ffb0739..6df98f2d09 100644
--- a/drivers/net/intel/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/intel/ixgbe/ixgbe_ethdev.c
@@ -1114,8 +1114,10 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
 	ixgbe_swfw_lock_reset(hw);
 
 	/* Initialize security_ctx only for primary process*/
-	if (ixgbe_ipsec_ctx_create(eth_dev))
-		return -ENOMEM;
+	if (ixgbe_ipsec_ctx_create(eth_dev)) {
+		ret = -ENOMEM;
+		goto err_exit;
+	}
 
 	/* Initialize DCB configuration*/
 	memset(dcb_config, 0, sizeof(struct ixgbe_dcb_config));
-- 
2.25.1



More information about the stable mailing list