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 8A8011B524 for ; Thu, 7 Feb 2019 14:27:55 +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 9DEC450F64; Thu, 7 Feb 2019 13:27:54 +0000 (UTC) Received: from ktraynor.remote.csb (unknown [10.33.36.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A34E85D33; Thu, 7 Feb 2019 13:27:49 +0000 (UTC) From: Kevin Traynor To: Tiwei Bie Cc: Maxime Coquelin , dpdk stable Date: Thu, 7 Feb 2019 13:25:34 +0000 Message-Id: <20190207132614.20538-28-ktraynor@redhat.com> In-Reply-To: <20190207132614.20538-1-ktraynor@redhat.com> References: <20190207132614.20538-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.30]); Thu, 07 Feb 2019 13:27:54 +0000 (UTC) Subject: [dpdk-stable] patch 'vhost: fix memory leak on realloc failure' has been queued to LTS release 18.11.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: Thu, 07 Feb 2019 13:27:55 -0000 Hi, FYI, your patch has been queued to LTS release 18.11.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 02/14/19. 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. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Kevin Traynor --- >>From 7144e55e3fd22598117d70241c0925f6b4a8eea2 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 401c4aa7b..19e04c953 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -734,11 +734,14 @@ add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr, { 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.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-02-07 13:19:56.195104917 +0000 +++ 0028-vhost-fix-memory-leak-on-realloc-failure.patch 2019-02-07 13:19:55.000000000 +0000 @@ -1,12 +1,13 @@ -From e1c0834f95597b1d5a889532281eb2fde6774ddd Mon Sep 17 00:00:00 2001 +From 7144e55e3fd22598117d70241c0925f6b4a8eea2 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,7 +16,7 @@ 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 401c4aa7b..19e04c953 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -734,11 +734,14 @@ add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr,