DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	stable@dpdk.org,
	Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>,
	John McNamara <john.mcnamara@intel.com>,
	Tero Aho <tero.aho@coriant.com>
Subject: [PATCH 2/2] net/pcap: handle > 64K packets in capture file
Date: Sat, 14 Nov 2026 10:57:01 -0800	[thread overview]
Message-ID: <20261114185701.833180-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20261114185701.833180-1-stephen@networkplumber.org>

If a pcap file given to the pcap PMD had a super jumbo frame
there would be a silent truncation and also the driver was not
checking for excessive number of mbuf segments.

Bugzilla ID: 2129
Fixes: 6db141c91e1f ("pcap: support jumbo frames")
Cc: stable@dpdk.org

Reported-by: Anthropic OSS scanner (ANT-2026-VD4V3KPV)
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/pcap/pcap_ethdev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index b89f4a0c2e..fb18f0932b 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -226,7 +226,7 @@ queue_missed_stat_get(struct rte_eth_dev *dev, unsigned int qid)
 
 static int
 eth_pcap_rx_jumbo(struct rte_mempool *mb_pool, struct rte_mbuf *mbuf,
-		const u_char *data, uint16_t data_len)
+		const u_char *data, uint32_t data_len)
 {
 	/* Copy the first segment. */
 	uint16_t len = rte_pktmbuf_tailroom(mbuf);
@@ -237,9 +237,12 @@ eth_pcap_rx_jumbo(struct rte_mempool *mb_pool, struct rte_mbuf *mbuf,
 	data += len;
 
 	while (data_len > 0) {
+		/* Avoid excessively long chain */
+		if (mbuf->nb_segs + 1 > RTE_MBUF_MAX_NB_SEGS)
+			return -1;
+
 		/* Allocate next mbuf and point to that. */
 		m->next = rte_pktmbuf_alloc(mb_pool);
-
 		if (unlikely(!m->next))
 			return -1;
 
-- 
2.53.0


      reply	other threads:[~2026-11-14 18:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 18:57 [PATCH 1/2] net/pcap: fix Rx timestamp in secondary process Stephen Hemminger
2026-11-14 18:57 ` Stephen Hemminger [this message]

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=20261114185701.833180-2-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=john.mcnamara@intel.com \
    --cc=sergio.gonzalez.monroy@intel.com \
    --cc=stable@dpdk.org \
    --cc=tero.aho@coriant.com \
    /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