From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id E569D2BAF; Wed, 15 Aug 2018 16:53:43 +0200 (CEST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180815145342euoutp01e8865c5ef7a690807b5f658b91d15266~LFnyxrrmP0898308983euoutp01K; Wed, 15 Aug 2018 14:53:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180815145342euoutp01e8865c5ef7a690807b5f658b91d15266~LFnyxrrmP0898308983euoutp01K DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1534344822; bh=bQRyuSgQulcYlWc22hFxoCgIDr8iv6xOD/lyHjAZisg=; h=From:To:Cc:Subject:Date:References:From; b=dKR2Q9o3vqLlMCqqIV1ViXcrvmC/+bfWFD5HRtnsqwWD0ffuels9gwpHKNn7CmHKk 6ZRG56MrbxGqFmEXt1AsmpjCwVsAUTDIr75rwe+0W3/L9tZEKH/0Puz5IogK04l23Y WyAJRFCbzOHdExkg2kKEP+LLui3Njmot0n/wboXs= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180815145342eucas1p267d6fab56e064474e9a0e705e867ec51~LFnyX8w_b0609406094eucas1p2j; Wed, 15 Aug 2018 14:53:42 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 4D.88.04294.67E347B5; Wed, 15 Aug 2018 15:53:42 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180815145341eucas1p15832e119a9d6f3fc54796675a283c44f~LFnxnA2os0902609026eucas1p15; Wed, 15 Aug 2018 14:53:41 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-ab-5b743e7673fe Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 0F.1F.04128.57E347B5; Wed, 15 Aug 2018 15:53:41 +0100 (BST) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PDI00IDQC1EJR40@eusync1.samsung.com>; Wed, 15 Aug 2018 15:53:41 +0100 (BST) From: Ilya Maximets To: dev@dpdk.org Cc: Maxime Coquelin , Tiwei Bie , Zhihong Wang , Junjie Chen , Ilya Maximets , stable@dpdk.org Date: Wed, 15 Aug 2018 17:54:39 +0300 Message-id: <20180815145439.2513-1-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBIsWRmVeSWpSXmKPExsWy7djP87pldiXRBk+Ocli8+7SdyeJK+092 i7NHHzNaHOvcw2Lxr+MPu8XWhv9MFpsvTmJyYPf4tWApq8fiPS+ZPN7vu8rm0bdlFWMASxSX TUpqTmZZapG+XQJXxqKJpgUbOCtmNvSxNzDeYO9i5OSQEDCRuH5iH0sXIxeHkMAKRokHe2Yw QzifGSX+LfzCAlN1b88fRojEMkaJR6s2sIEkhASamST+7OUEsdkEdCROrT7CCGKLCAhIfO5c zAbSwCxwj1Fi/ZGnTCAJYQEHibY9T8GmsgioSnSf/c0MYvMKWElM7fzFDLFNXmL1hgNgZ0gI PGWV+L+ilQ0i4SJx9EkTI4QtLPHq+BaoJ2QkLk/uhjq1XuJ+y0tGiOYORonph/4xQSTsJba8 PgfWwCzAJzFp23SgDRxAcV6JjjYhiBIPiVUPvjJDfBYrcfTuZsYJjBILGBlWMYqnlhbnpqcW G+WllusVJ+YWl+al6yXn525iBMbX6X/Hv+xg3PUn6RCjAAejEg/vA8OSaCHWxLLiytxDjBIc zEoivGp8QCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8fFpp0UIC6YklqdmpqQWpRTBZJg5OqQZG 9TUccT/SxLa23XMu93rcwWecMLe1aI/Nmrlzo5+t13bO4v8ptXKW2O4XYj4X2/9FlM3KXNrx 7DDbmnMd+/xZp/LtMtL89TjN+n13yfFXIpErncLmuO5dYCpye2fg1eZjq84smfi7Nu9E7M7J JY+Y3k/vTOs5sGqv1A2j3fxJEoG73BcEC92SVmIpzkg01GIuKk4EAOJgJlarAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNJMWRmVeSWpSXmKPExsVy+t/xy7qldiXRBnv7lS3efdrOZHGl/Se7 xdmjjxktjnXuYbH41/GH3WJrw38mi80XJzE5sHv8WrCU1WPxnpdMHu/3XWXz6NuyijGAJYrL JiU1J7MstUjfLoErY9FE04INnBUzG/rYGxhvsHcxcnJICJhI3Nvzh7GLkYtDSGAJo8SCvy9Y IJxWJom//5qZQarYBHQkTq0+wghiiwgISHzuXMwGUsQscI9RYt2kJlaQhLCAg0TbnqcsIDaL gKpE99nfYM28AlYSUzt/MUOsk5dYveEA8wRGrgWMDKsYRVJLi3PTc4uN9IoTc4tL89L1kvNz NzECg2DbsZ9bdjB2vQs+xCjAwajEw/vAsCRaiDWxrLgy9xCjBAezkgivGh9QiDclsbIqtSg/ vqg0J7X4EKM0B4uSOO95g8ooIYH0xJLU7NTUgtQimCwTB6dUA2N9HJvDbT9zI2X9N1+qH/ut uZ4kliM/yeKeHbfuhW+T13P9PpPt91ddKFfxYPeHiIUdT0OUQ5U+9L3Q+N6iM99n6r7ICfrr bbpUS0P/ZsXGeNqe6F/I5Pf67Ju+r13JCxmYNp/4sbHninLPo5chH6YJtfEqvFf3+F3JscYw l3fpjFDvM0vfbVJiKc5INNRiLipOBACkTxCT/gEAAA== X-CMS-MailID: 20180815145341eucas1p15832e119a9d6f3fc54796675a283c44f X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180815145341eucas1p15832e119a9d6f3fc54796675a283c44f References: Subject: [dpdk-stable] [PATCH] vhost: fix zmbufs array leak after NUMA realloc 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: Wed, 15 Aug 2018 14:53:44 -0000 '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 --- 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 @@ -357,11 +357,13 @@ numa_realloc(struct virtio_net *dev, int index) memcpy(vq, old_vq, sizeof(*vq)); 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; + } } if (vq_is_packed(dev)) { -- 2.17.1