From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
stable@dpdk.org, Chas Williams <3chas3@gmail.com>,
Ferruh Yigit <ferruh.yigit@amd.com>
Subject: [PATCH] net/af_packet: move size check to after vlan insert
Date: Wed, 28 Oct 2026 15:48:07 -0700 [thread overview]
Message-ID: <20261028224807.1629044-1-stephen@networkplumber.org> (raw)
This fixes a corner case where vlan is insert and the resulting
packet exceeds the TPACKET_V2 ring slot size.
Reported-by: Anthropic OSS scanner
Fixes: 23deeebfcfa8 ("net/af_packet: support 802.1Q VLAN")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/af_packet/rte_eth_af_packet.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index ef57719803..6bec12a735 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -318,12 +318,6 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
for (i = 0; i < nb_pkts; i++) {
mbuf = *bufs++;
- /* drop oversized packets */
- if (mbuf->pkt_len > pkt_q->frame_data_size) {
- rte_pktmbuf_free(mbuf);
- continue;
- }
-
/* insert vlan info if necessary */
if (mbuf->ol_flags & RTE_MBUF_F_TX_VLAN) {
if (rte_vlan_insert(&mbuf)) {
@@ -332,6 +326,12 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
}
}
+ /* drop oversized packets */
+ if (mbuf->pkt_len > pkt_q->frame_data_size) {
+ rte_pktmbuf_free(mbuf);
+ continue;
+ }
+
/* point at the next incoming frame */
if (!tx_ring_status_available(ppd->tp_status)) {
if (poll(&pfd, 1, -1) < 0)
--
2.53.0
reply other threads:[~2026-10-28 22:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261028224807.1629044-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=3chas3@gmail.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=stable@dpdk.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