From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH v2] net/af_packet: fix vlan_insert corruption
Date: Mon, 8 Apr 2019 09:41:12 -0700 [thread overview]
Message-ID: <20190408164112.12471-1-stephen@networkplumber.org> (raw)
Message-ID: <20190408164112.mhi5JeFSrmxFmLiBQ_LPK2pTlxfe1dI0wDRnyGNrFhg@z> (raw)
In-Reply-To: <20190408160419.7409-1-stephen@networkplumber.org>
If the af_packet transmit is sending a VLAN packet,
and the transmit path to the kernel os full, then it would
mismanage the outgoing mbuf. The original mbuf would end up
being freed twice, once by AF_PACKET PMD and once by caller.
Reported-by: Chas Williams <3chas3@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v2 - fix unnecessary parenthesis (was in original code)
drivers/net/af_packet/rte_eth_af_packet.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 99e13fe48a30..91ceb94ecbaa 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -200,6 +200,11 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
continue;
}
+ /* point at the next incoming frame */
+ if (ppd->tp_status != TP_STATUS_AVAILABLE &&
+ poll(&pfd, 1, -1) < 0)
+ break;
+
/* insert vlan info if necessary */
if (mbuf->ol_flags & PKT_TX_VLAN_PKT) {
if (rte_vlan_insert(&mbuf)) {
@@ -208,11 +213,6 @@ eth_af_packet_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
}
}
- /* point at the next incoming frame */
- if ((ppd->tp_status != TP_STATUS_AVAILABLE) &&
- (poll(&pfd, 1, -1) < 0))
- break;
-
/* copy the tx frame data */
pbuf = (uint8_t *) ppd + TPACKET2_HDRLEN -
sizeof(struct sockaddr_ll);
--
2.17.1
next prev parent reply other threads:[~2019-04-08 16:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-08 16:04 [dpdk-dev] [PATCH] " Stephen Hemminger
2019-04-08 16:04 ` Stephen Hemminger
2019-04-08 16:41 ` Stephen Hemminger [this message]
2019-04-08 16:41 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2019-04-12 16:28 ` Ferruh Yigit
2019-04-12 16:28 ` Ferruh Yigit
2019-04-12 22:08 ` Stephen Hemminger
2019-04-12 22:08 ` Stephen Hemminger
2019-04-16 9:37 ` Ferruh Yigit
2019-04-16 9:37 ` Ferruh Yigit
2019-04-16 9:42 ` Bruce Richardson
2019-04-16 9:42 ` Bruce Richardson
2019-04-16 15:03 ` Stephen Hemminger
2019-04-16 15:03 ` Stephen Hemminger
2019-04-16 15:13 ` Bruce Richardson
2019-04-16 15:13 ` Bruce Richardson
2019-07-04 18:43 ` Ferruh Yigit
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=20190408164112.12471-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@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;
as well as URLs for NNTP newsgroup(s).