[PATCH v6 10/45] net/sxe2: clear security context pointer on uninit

liujie5 at linkdatatechnology.com liujie5 at linkdatatechnology.com
Fri Aug 28 09:37:35 CEST 2026


From: Jie Liu <liujie5 at linkdatatechnology.com>

sxe2_security_uinit() frees the security session but leaves
dev->security_ctx pointing at the freed memory. Set
dev->security_ctx to NULL after releasing the security context
so a later access does not dereference a dangling pointer.

Cc: stephen at networkplumber.org
Signed-off-by: Jie Liu <liujie5 at linkdatatechnology.com>
---
 drivers/net/sxe2/sxe2_security.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/sxe2/sxe2_security.c b/drivers/net/sxe2/sxe2_security.c
index bc59d1b880..8f31067942 100644
--- a/drivers/net/sxe2/sxe2_security.c
+++ b/drivers/net/sxe2/sxe2_security.c
@@ -326,6 +326,7 @@ void sxe2_security_uinit(struct rte_eth_dev *dev)
 	if (sctx != NULL) {
 		rte_free(sctx);
 		sctx = NULL;
+		dev->security_ctx = NULL;
 	}
 
 	sxe2_ipsec_uinit(adapter);
-- 
2.52.0



More information about the dev mailing list