From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 57B25A0096 for ; Mon, 8 Apr 2019 18:41:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0F6B34F93; Mon, 8 Apr 2019 18:41:19 +0200 (CEST) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 902254F91 for ; Mon, 8 Apr 2019 18:41:17 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id y13so7929501pfm.11 for ; Mon, 08 Apr 2019 09:41:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AJmCqw5CONEe+LTUHHLS48kczS+WPJM5+EAzh1CYMOU=; b=TSn33g8C8SKSB0yEMugVjLhiG2Ja/9EKR0oIcJvZ4w3cjMxe755m2J9UbOGE6IUzAJ pmjThpQHrWRCSYcr6OypMJkvE7MKHVQc2u8fLKYVOYcHNpwAQaRpT2j+2xG9J0H6wUSB hRKwKzzWC+dJE6bivYPAFGaEsves4N26cq4vVeaEGAeMV1gOCtAfDqOHMZxdp9HMfkLk xU1JfaJ2lqeRE85MpcxGsLKaLcNlCqruCwOmxQW8MLrg5Q65jDOmIQOX/8zoj31YGmkR DQZdqJEQyJGJuHC4ppx5zpoi7L52kgJFgf9MGLJuTOWqo+wvoSvahY4OmdwHfmCn6YSf lPng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AJmCqw5CONEe+LTUHHLS48kczS+WPJM5+EAzh1CYMOU=; b=qiosK9kwNSEjyRBw3T5n0oz+uCcAR+E3sI37X4pMVNfU/u7GZF2BKEPSR6T/KBL4md L4k8MG2nDVB1DOqzEI2i+pcrcB7t+AaSHZzmRwP2NRUF7PLp1kfVkd2s7F/34Cw1d011 TcPEd2t/PLIAJrNH8lNRbwR8sjLPVvsN+BUpCCWhe779j1VHTpWtnVLj0YDuKPucQs3Q mGKA3qHCbv375J9BpoRw4QCiKaUD1evIc1/98DeVyVXU8r5DMzp3iJ36XuRFlJnA6TEm Vdxe+7H2eVxgdw0NWU4rUOSK2PJAPKpPMT5qP5NOyiQCU1nSy7AmuYcu+38wamEjOL7t BnXQ== X-Gm-Message-State: APjAAAX0j8zeD2Qn3cePDrLfzIB6Tw4v5laLu3+2aaMDJb1EutAbZMrZ QB15/YpX/YFMfZp/PtAShD0EnP/E4U7i1g== X-Google-Smtp-Source: APXvYqwD5iGioEyxOr24NuLGzepTR9w71lW4RulCDej/FPz6P3PCFUPg3c/lyo3XwBFqMQU1vLLgUQ== X-Received: by 2002:a63:4a5a:: with SMTP id j26mr29373857pgl.361.1554741676222; Mon, 08 Apr 2019 09:41:16 -0700 (PDT) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id w1sm5698720pfw.101.2019.04.08.09.41.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Apr 2019 09:41:15 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Mon, 8 Apr 2019 09:41:12 -0700 Message-Id: <20190408164112.12471-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190408160419.7409-1-stephen@networkplumber.org> References: <20190408160419.7409-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v2] net/af_packet: fix vlan_insert corruption X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190408164112.mhi5JeFSrmxFmLiBQ_LPK2pTlxfe1dI0wDRnyGNrFhg@z> 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 --- 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