From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 333291B3AC for ; Fri, 5 Apr 2019 02:03:47 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id w25so753156pfi.9 for ; Thu, 04 Apr 2019 17:03:47 -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; bh=wy4U3zIT9wlw8a91bQIdZX+MkjkVht/yBk/hLnV2N7s=; b=EVxGJMiXEMxJ+sE5afO6UecXKnrEEz64vZQ2Ynwv/n+SogG0ZWRQc54CnukjxSw1AQ Bhf0kPt6vbdUdCh8YeZfXYbgBCZmxkNf7g6IOpBo2JqW/5cYtoSKJ5KJjQAeg3Fid1K8 pTlc0FU+rAhVkkcvkNJKzJE2dvvyTp4r7qCjpwHt6tyKhMPgnB3foUilG+gP2JmNnmZK qOmya1QgRxxK3XD35bpQU1GeR2s9AKIDGolJBXyamvnH9FG2Wi2vlfWtXt7l+dxI5q+N aw+hW47UsHBWvo+tqr01b0sg7KRDFn5t37toxoqH83gR91EJ88W1s/MnIb5bywlyjEVn J0+Q== 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; bh=wy4U3zIT9wlw8a91bQIdZX+MkjkVht/yBk/hLnV2N7s=; b=G7aG5mQlTDoBOpfBuxsqyOPoewECmrBd+/t3VTJStfrhbnN/LcAttNMHi9DFnzLyC3 u0qumolXcTDWLTMz7ovS2FYmZPWnzJqvPklTAPavAQ9cSWREbhidw48A3qUIZ/e8TDXq fSqZl8m0WpRrhlzsxiHtUsAm3Tf9RaVeutAK8RERjBfBrLqGJkMz92EL6khcX+Oa9rjO 78/uss8Mm4hqHXplKV78mXPnqWFg29J9B+0UM0CIM06kqUOgfCF0rFGDowdkIJl/l/y3 0WMe7Mlc70WokQ6DgFEkVaa1IpbXwpA/CVMqelxg8ODPSCQgJfUelcLr914G39N1R+9P ns5g== X-Gm-Message-State: APjAAAVAiygYxIfJfWkGaTHseqzxv8tlQKt0LZ+SzOGlo0enULB6V75H GXgyiRXtyKRB6nrklD5H9HplGA== X-Google-Smtp-Source: APXvYqxju5IugQa+4j/pL5hyKEM0yB62O+3r55dp2YeicfSgZaniJQC/hBElLpmxz/+omxZ8kQFrMg== X-Received: by 2002:a63:7843:: with SMTP id t64mr8332167pgc.178.1554422626193; Thu, 04 Apr 2019 17:03:46 -0700 (PDT) Received: from localhost.localdomain ([167.220.104.255]) by smtp.gmail.com with ESMTPSA id v6sm24866814pgv.92.2019.04.04.17.03.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 17:03:44 -0700 (PDT) From: Stephen Hemminger To: maxime.coquelin@redhat.com Cc: dev@dpdk.org, stable@dpdk.org, Stephen Hemminger Date: Thu, 4 Apr 2019 17:03:43 -0700 Message-Id: <20190405000343.24424-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] virtio: fix buffer leak on vlan insert 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: , X-List-Received-Date: Fri, 05 Apr 2019 00:03:47 -0000 The function rte_vlan_insert may allocate a new buffer for the vlan header and return a different mbuf than originally passed. In this case, the stored mbuf in txm[] array could point to wrong buffer. Fixes: dd856dfcb9e7 ("virtio: use any layout on Tx") Signed-off-by: Stephen Hemminger --- drivers/net/virtio/virtio_rxtx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index e6f3706d6fe1..2ae4232c181d 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -2003,6 +2003,8 @@ virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts, rte_pktmbuf_free(txm); continue; } + /* vlan_insert may add a header mbuf */ + tx_pkts[nb_tx] = txm; } /* optimize ring usage */ -- 2.17.1 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 78A73A0679 for ; Fri, 5 Apr 2019 02:03:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 59B651B3B5; Fri, 5 Apr 2019 02:03:49 +0200 (CEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id 333291B3AC for ; Fri, 5 Apr 2019 02:03:47 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id w25so753156pfi.9 for ; Thu, 04 Apr 2019 17:03:47 -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; bh=wy4U3zIT9wlw8a91bQIdZX+MkjkVht/yBk/hLnV2N7s=; b=EVxGJMiXEMxJ+sE5afO6UecXKnrEEz64vZQ2Ynwv/n+SogG0ZWRQc54CnukjxSw1AQ Bhf0kPt6vbdUdCh8YeZfXYbgBCZmxkNf7g6IOpBo2JqW/5cYtoSKJ5KJjQAeg3Fid1K8 pTlc0FU+rAhVkkcvkNJKzJE2dvvyTp4r7qCjpwHt6tyKhMPgnB3foUilG+gP2JmNnmZK qOmya1QgRxxK3XD35bpQU1GeR2s9AKIDGolJBXyamvnH9FG2Wi2vlfWtXt7l+dxI5q+N aw+hW47UsHBWvo+tqr01b0sg7KRDFn5t37toxoqH83gR91EJ88W1s/MnIb5bywlyjEVn J0+Q== 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; bh=wy4U3zIT9wlw8a91bQIdZX+MkjkVht/yBk/hLnV2N7s=; b=G7aG5mQlTDoBOpfBuxsqyOPoewECmrBd+/t3VTJStfrhbnN/LcAttNMHi9DFnzLyC3 u0qumolXcTDWLTMz7ovS2FYmZPWnzJqvPklTAPavAQ9cSWREbhidw48A3qUIZ/e8TDXq fSqZl8m0WpRrhlzsxiHtUsAm3Tf9RaVeutAK8RERjBfBrLqGJkMz92EL6khcX+Oa9rjO 78/uss8Mm4hqHXplKV78mXPnqWFg29J9B+0UM0CIM06kqUOgfCF0rFGDowdkIJl/l/y3 0WMe7Mlc70WokQ6DgFEkVaa1IpbXwpA/CVMqelxg8ODPSCQgJfUelcLr914G39N1R+9P ns5g== X-Gm-Message-State: APjAAAVAiygYxIfJfWkGaTHseqzxv8tlQKt0LZ+SzOGlo0enULB6V75H GXgyiRXtyKRB6nrklD5H9HplGA== X-Google-Smtp-Source: APXvYqxju5IugQa+4j/pL5hyKEM0yB62O+3r55dp2YeicfSgZaniJQC/hBElLpmxz/+omxZ8kQFrMg== X-Received: by 2002:a63:7843:: with SMTP id t64mr8332167pgc.178.1554422626193; Thu, 04 Apr 2019 17:03:46 -0700 (PDT) Received: from localhost.localdomain ([167.220.104.255]) by smtp.gmail.com with ESMTPSA id v6sm24866814pgv.92.2019.04.04.17.03.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 17:03:44 -0700 (PDT) From: Stephen Hemminger To: maxime.coquelin@redhat.com Cc: dev@dpdk.org, stable@dpdk.org, Stephen Hemminger Date: Thu, 4 Apr 2019 17:03:43 -0700 Message-Id: <20190405000343.24424-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] virtio: fix buffer leak on vlan insert 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: <20190405000343.uEZI4mJalMARk_Kh8RTfY6LkszhNKnIFPwb4I794w6g@z> The function rte_vlan_insert may allocate a new buffer for the vlan header and return a different mbuf than originally passed. In this case, the stored mbuf in txm[] array could point to wrong buffer. Fixes: dd856dfcb9e7 ("virtio: use any layout on Tx") Signed-off-by: Stephen Hemminger --- drivers/net/virtio/virtio_rxtx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index e6f3706d6fe1..2ae4232c181d 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -2003,6 +2003,8 @@ virtio_xmit_pkts_packed(void *tx_queue, struct rte_mbuf **tx_pkts, rte_pktmbuf_free(txm); continue; } + /* vlan_insert may add a header mbuf */ + tx_pkts[nb_tx] = txm; } /* optimize ring usage */ -- 2.17.1