From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 0BF5F326C for ; Tue, 20 Nov 2018 20:15:03 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6F2DE3082134; Tue, 20 Nov 2018 19:15:02 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79D9D60141; Tue, 20 Nov 2018 19:15:00 +0000 (UTC) From: Kevin Traynor To: Ilya Maximets Cc: Tiwei Bie , dpdk stable Date: Tue, 20 Nov 2018 19:12:17 +0000 Message-Id: <20181120191252.30277-27-ktraynor@redhat.com> In-Reply-To: <20181120191252.30277-1-ktraynor@redhat.com> References: <20181120191252.30277-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 20 Nov 2018 19:15:02 +0000 (UTC) Subject: [dpdk-stable] patch 'vhost: fix zmbufs array leak after NUMA realloc' has been queued to stable release 18.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Nov 2018 19:15:03 -0000 Hi, FYI, your patch has been queued to stable release 18.08.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/23/18. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Kevin Traynor --- >>From c816d40a36af4341b05137dc064a29287abee12a Mon Sep 17 00:00:00 2001 From: Ilya Maximets Date: Wed, 15 Aug 2018 17:54:39 +0300 Subject: [PATCH] vhost: fix zmbufs array leak after NUMA realloc [ upstream commit 28925156d91bedb8f4b85b10dd9f3303a4d9e759 ] 'numa_realloc()' allocates 'zmbufs' even if zero copy mode is not configured. This leads to memory leak, because array is freed only for zero copy case. Fixes: 2651726defb7 ("vhost: do deep copy while reallocating queue") Signed-off-by: Ilya Maximets Reviewed-by: Tiwei Bie --- lib/librte_vhost/vhost_user.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index a2d4c9ffc..9aa1ce118 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -358,9 +358,11 @@ numa_realloc(struct virtio_net *dev, int index) TAILQ_INIT(&vq->zmbuf_list); - new_zmbuf = rte_malloc_socket(NULL, vq->zmbuf_size * - sizeof(struct zcopy_mbuf), 0, newnode); - if (new_zmbuf) { - rte_free(vq->zmbufs); - vq->zmbufs = new_zmbuf; + if (dev->dequeue_zero_copy) { + new_zmbuf = rte_malloc_socket(NULL, vq->zmbuf_size * + sizeof(struct zcopy_mbuf), 0, newnode); + if (new_zmbuf) { + rte_free(vq->zmbufs); + vq->zmbufs = new_zmbuf; + } } -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-11-20 17:53:08.118520121 +0000 +++ 0027-vhost-fix-zmbufs-array-leak-after-NUMA-realloc.patch 2018-11-20 17:53:07.000000000 +0000 @@ -1,14 +1,15 @@ -From 28925156d91bedb8f4b85b10dd9f3303a4d9e759 Mon Sep 17 00:00:00 2001 +From c816d40a36af4341b05137dc064a29287abee12a Mon Sep 17 00:00:00 2001 From: Ilya Maximets Date: Wed, 15 Aug 2018 17:54:39 +0300 Subject: [PATCH] vhost: fix zmbufs array leak after NUMA realloc +[ upstream commit 28925156d91bedb8f4b85b10dd9f3303a4d9e759 ] + 'numa_realloc()' allocates 'zmbufs' even if zero copy mode is not configured. This leads to memory leak, because array is freed only for zero copy case. Fixes: 2651726defb7 ("vhost: do deep copy while reallocating queue") -CC: stable@dpdk.org Signed-off-by: Ilya Maximets Reviewed-by: Tiwei Bie