DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: liujie5@linkdatatechnology.com
To: stephen@networkplumber.org
Cc: dev@dpdk.org, Jie Liu <liujie5@linkdatatechnology.com>
Subject: [PATCH v2 07/13] net/sxe2: validate IPsec key length against maximum limit
Date: Sun, 16 Aug 2026 10:52:27 +0800	[thread overview]
Message-ID: <20260816025233.2727226-8-liujie5@linkdatatechnology.com> (raw)
In-Reply-To: <20260816025233.2727226-1-liujie5@linkdatatechnology.com>

From: Jie Liu <liujie5@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@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


  parent reply	other threads:[~2026-08-16  2:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16  2:52 [PATCH v2 00/13] driver/sxe2: fix bugs liujie5
2026-08-16  2:52 ` [PATCH v2 01/13] net/sxe2: add Rx queue buffer split fill support liujie5
2026-08-16  2:52 ` [PATCH v2 02/13] net/sxe2: update switchdev repr VSI ID display format liujie5
2026-08-16  2:52 ` [PATCH v2 03/13] net/sxe2: add ACL engine event statistics support liujie5
2026-08-16  2:52 ` [PATCH v2 04/13] net/sxe2: enhance device cap and res management liujie5
2026-08-16  2:52 ` [PATCH v2 05/13] net/sxe2: improve representor device initialization liujie5
2026-08-16  2:52 ` [PATCH v2 06/13] net/sxe2: refactor flow tunnel port handling liujie5
2026-08-16  2:52 ` liujie5 [this message]
2026-08-16  2:52 ` [PATCH v2 08/13] net/sxe2: enhance repr event handling and MP code liujie5
2026-08-16  2:52 ` [PATCH v2 09/13] net/sxe2: optimize vectorized Tx/Rx path liujie5
2026-08-16  2:52 ` [PATCH v2 10/13] common/sxe2: allow munmap during kernel reset liujie5
2026-08-16  2:52 ` [PATCH v2 11/13] net/sxe2: clean up duplicate function declarations liujie5
2026-08-16  2:52 ` [PATCH v2 12/13] net/sxe2: clean up structure definitions liujie5
2026-08-16  2:52 ` [PATCH v2 13/13] doc/sxe2: add acl-stat-type parameter documentation liujie5

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260816025233.2727226-8-liujie5@linkdatatechnology.com \
    --to=liujie5@linkdatatechnology.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox