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 8E5CFA0679 for ; Fri, 5 Apr 2019 09:44:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 56D501B469; Fri, 5 Apr 2019 09:44:10 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 2943A1B45D; Fri, 5 Apr 2019 09:44:08 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DE47AC05678B; Fri, 5 Apr 2019 07:44:06 +0000 (UTC) Received: from localhost (dhcp-192-206.str.redhat.com [10.33.192.206]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61E865F9BC; Fri, 5 Apr 2019 07:44:02 +0000 (UTC) Date: Fri, 5 Apr 2019 09:43:58 +0200 From: Jens Freimann To: Stephen Hemminger Cc: maxime.coquelin@redhat.com, dev@dpdk.org, stable@dpdk.org Message-ID: <20190405074358.c5dhohtsesxiwj2m@jenstp.localdomain> References: <20190405000343.24424-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format="flowed" Content-Disposition: inline In-Reply-To: <20190405000343.24424-1-stephen@networkplumber.org> User-Agent: NeoMutt/20180716-1376-5d6ed1 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 05 Apr 2019 07:44:07 +0000 (UTC) Subject: Re: [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" Message-ID: <20190405074358.e20IAX5w4NERBIlLXP26Z8WEgTQWYAO0iQUCXTQU-FI@z> On Thu, Apr 04, 2019 at 05:03:43PM -0700, Stephen Hemminger wrote: >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 */ Good catch. I think we have the same bug in virtio_xmit_pkts() and virtio_xmit_pkts_inorder() and should fix these as well. Thanks! regards, Jens