DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/af_packet: fix vlan_insert corruption
@ 2019-04-08 16:04 Stephen Hemminger
  2019-04-08 16:04 ` Stephen Hemminger
  2019-04-08 16:41 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
  0 siblings, 2 replies; 17+ messages in thread
From: Stephen Hemminger @ 2019-04-08 16:04 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

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>
---
 drivers/net/af_packet/rte_eth_af_packet.c | 11 ++++++-----
 1 file changed, 6 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..24a68c26d665 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -200,6 +200,12 @@ 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 +214,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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-07-04 18:43 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08 16:04 [dpdk-dev] [PATCH] net/af_packet: fix vlan_insert corruption Stephen Hemminger
2019-04-08 16:04 ` Stephen Hemminger
2019-04-08 16:41 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2019-04-08 16:41   ` 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

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).