[PATCH v1 07/13] net/sxe2: validate IPsec key length against maximum limit
liujie5 at linkdatatechnology.com
liujie5 at linkdatatechnology.com
Mon Aug 17 04:53:33 CEST 2026
From: Jie Liu <liujie5 at linkdatatechnology.com>
Add validation check in sxe2_security_valid_key to ensure source key
length does not exceed SXE2_IPSEC_MAX_KEY_LEN. This prevents potential
buffer overflows when processing security keys that are longer than
the supported maximum length.
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