[dpdk-stable] patch 'vhost: fix memory leak on realloc failure' has been queued to LTS release 18.11.1

Kevin Traynor ktraynor at redhat.com
Thu Feb 7 14:25:34 CET 2019


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 <tiwei.bie at intel.com>
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 <tiwei.bie at intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
 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 <tiwei.bie at intel.com>
 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 at dpdk.org
 
 Signed-off-by: Tiwei Bie <tiwei.bie at intel.com>
 Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
@@ -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,


More information about the stable mailing list