From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id AAEF12BA5 for ; Fri, 8 Mar 2019 18:49:22 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 8 Mar 2019 19:49:20 +0200 Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx [10.101.0.96]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x28HloBA002625; Fri, 8 Mar 2019 19:49:19 +0200 From: Yongseok Koh To: Tiwei Bie Cc: Maxime Coquelin , dpdk stable Date: Fri, 8 Mar 2019 09:47:32 -0800 Message-Id: <20190308174749.30771-54-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190308174749.30771-1-yskoh@mellanox.com> References: <20190308174749.30771-1-yskoh@mellanox.com> Subject: [dpdk-stable] patch 'vhost: fix memory leak on realloc failure' has been queued to LTS release 17.11.6 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: Fri, 08 Mar 2019 17:49:23 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objection by 03/13/19. So please shout if anyone has objection. 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. Yongseok --- >>From e4b5a49bbad8abbb10b772f78f29ff8f7ef00248 Mon Sep 17 00:00:00 2001 From: Tiwei Bie Date: Tue, 15 Jan 2019 15:13:23 +0800 Subject: [PATCH] vhost: fix memory leak on realloc failure [ upstream commit e1c0834f95597b1d5a889532281eb2fde6774ddd ] When realloc() fails, the original block isn't freed. Fixes: e246896178e6 ("vhost: get guest/host physical address mappings") Signed-off-by: Tiwei Bie Reviewed-by: Maxime Coquelin --- lib/librte_vhost/vhost_user.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index aacf75b13..61e82d154 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -510,13 +510,16 @@ add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr, uint64_t host_phys_addr, uint64_t size) { struct guest_page *page, *last_page; + struct guest_page *old_pages; if (dev->nr_guest_pages == dev->max_guest_pages) { dev->max_guest_pages *= 2; + old_pages = dev->guest_pages; dev->guest_pages = realloc(dev->guest_pages, dev->max_guest_pages * sizeof(*page)); if (!dev->guest_pages) { RTE_LOG(ERR, VHOST_CONFIG, "cannot realloc guest_pages\n"); + free(old_pages); return -1; } } -- 2.11.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-03-08 09:46:42.879871570 -0800 +++ 0054-vhost-fix-memory-leak-on-realloc-failure.patch 2019-03-08 09:46:40.279403000 -0800 @@ -1,12 +1,13 @@ -From e1c0834f95597b1d5a889532281eb2fde6774ddd Mon Sep 17 00:00:00 2001 +From e4b5a49bbad8abbb10b772f78f29ff8f7ef00248 Mon Sep 17 00:00:00 2001 From: Tiwei Bie Date: Tue, 15 Jan 2019 15:13:23 +0800 Subject: [PATCH] vhost: fix memory leak on realloc failure +[ upstream commit e1c0834f95597b1d5a889532281eb2fde6774ddd ] + When realloc() fails, the original block isn't freed. Fixes: e246896178e6 ("vhost: get guest/host physical address mappings") -Cc: stable@dpdk.org Signed-off-by: Tiwei Bie Reviewed-by: Maxime Coquelin @@ -15,10 +16,10 @@ 1 file changed, 3 insertions(+) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c -index f2f30369b..78be6cfa5 100644 +index aacf75b13..61e82d154 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c -@@ -733,13 +733,16 @@ add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr, +@@ -510,13 +510,16 @@ add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr, uint64_t host_phys_addr, uint64_t size) { struct guest_page *page, *last_page;