[PATCH v3 10/51] net/sxe2: validate IPsec key length against maximum limit
liujie5 at linkdatatechnology.com
liujie5 at linkdatatechnology.com
Wed Aug 26 10:54:37 CEST 2026
From: Jie Liu <liujie5 at linkdatatechnology.com>
Add validation in sxe2_security_valid_key to ensure the source key
length does not exceed SXE2_IPSEC_MAX_KEY_LEN, preventing potential
buffer overflows when processing keys longer than the supported
maximum. Also clear the security context pointer after releasing the
security session during uninit.
Cc: stephen at networkplumber.org
Signed-off-by: Jie Liu <liujie5 at linkdatatechnology.com>
---
drivers/net/sxe2/sxe2_ipsec.c | 5 +++++
drivers/net/sxe2/sxe2_security.c | 1 +
2 files changed, 6 insertions(+)
diff --git a/drivers/net/sxe2/sxe2_ipsec.c b/drivers/net/sxe2/sxe2_ipsec.c
index e783a51b85..622fd1adfe 100644
--- a/drivers/net/sxe2/sxe2_ipsec.c
+++ b/drivers/net/sxe2/sxe2_ipsec.c
@@ -254,6 +254,11 @@ static bool sxe2_security_valid_key(uint16_t src_key, uint16_t max_key,
goto l_end;
}
+ if (src_key > SXE2_IPSEC_MAX_KEY_LEN) {
+ is_valid = false;
+ goto l_end;
+ }
+
is_valid = true;
l_end:
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