[dpdk-stable] patch 'eal/linux: fix memory leak in uevent handling' has been queued to LTS release 18.11.11

Kevin Traynor ktraynor at redhat.com
Wed Nov 18 17:35:24 CET 2020


Hi,

FYI, your patch has been queued to LTS release 18.11.11

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/24/20. 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.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/9d7c95022a36cc2282aa8953806da2acaaea47df

Thanks.

Kevin.

---
>From 9d7c95022a36cc2282aa8953806da2acaaea47df Mon Sep 17 00:00:00 2001
From: Yunjian Wang <wangyunjian at huawei.com>
Date: Sat, 23 May 2020 18:52:21 +0800
Subject: [PATCH] eal/linux: fix memory leak in uevent handling

[ upstream commit 01072d52affac0f7fb6b8a5c8dd98015c4cef4c3 ]

When the memory for uevent.devname is allocated in dev_uev_parse(). It
is not freed when parse the subsystem layer fails in dev_uev_parse().
Before return, it is also not freed in dev_uev_handler(). These cause a
memory leak.

Fixes: 0d0f478d0483 ("eal/linux: add uevent parse and process")

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
Reviewed-by: David Marchand <david.marchand at redhat.com>
---
 lib/librte_eal/linuxapp/eal/eal_dev.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_dev.c b/lib/librte_eal/linuxapp/eal/eal_dev.c
index c41809380d..07172d2109 100644
--- a/lib/librte_eal/linuxapp/eal/eal_dev.c
+++ b/lib/librte_eal/linuxapp/eal/eal_dev.c
@@ -190,5 +190,5 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
 		event->subsystem = EAL_DEV_EVENT_SUBSYSTEM_VFIO;
 	else
-		return -1;
+		goto err;
 
 	/* parse the action type */
@@ -198,6 +198,9 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
 		event->type = RTE_DEV_EVENT_REMOVE;
 	else
-		return -1;
+		goto err;
 	return 0;
+err:
+	free(event->devname);
+	return -1;
 }
 
@@ -278,4 +281,5 @@ dev_uev_handler(__rte_unused void *param)
 		}
 		rte_dev_event_callback_process(uevent.devname, uevent.type);
+		free(uevent.devname);
 	}
 
@@ -284,4 +288,5 @@ dev_uev_handler(__rte_unused void *param)
 failure_handle_err:
 	rte_spinlock_unlock(&failure_handle_lock);
+	free(uevent.devname);
 }
 
-- 
2.26.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-11-18 16:33:38.659061661 +0000
+++ 0038-eal-linux-fix-memory-leak-in-uevent-handling.patch	2020-11-18 16:33:37.937215067 +0000
@@ -1 +1 @@
-From 01072d52affac0f7fb6b8a5c8dd98015c4cef4c3 Mon Sep 17 00:00:00 2001
+From 9d7c95022a36cc2282aa8953806da2acaaea47df Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 01072d52affac0f7fb6b8a5c8dd98015c4cef4c3 ]
+
@@ -12 +13,0 @@
-Cc: stable at dpdk.org
@@ -17 +18 @@
- lib/librte_eal/linux/eal_dev.c | 9 +++++++--
+ lib/librte_eal/linuxapp/eal/eal_dev.c | 9 +++++++--
@@ -20,5 +21,5 @@
-diff --git a/lib/librte_eal/linux/eal_dev.c b/lib/librte_eal/linux/eal_dev.c
-index 2e15762b56..5c0e752b2d 100644
---- a/lib/librte_eal/linux/eal_dev.c
-+++ b/lib/librte_eal/linux/eal_dev.c
-@@ -196,5 +196,5 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
+diff --git a/lib/librte_eal/linuxapp/eal/eal_dev.c b/lib/librte_eal/linuxapp/eal/eal_dev.c
+index c41809380d..07172d2109 100644
+--- a/lib/librte_eal/linuxapp/eal/eal_dev.c
++++ b/lib/librte_eal/linuxapp/eal/eal_dev.c
+@@ -190,5 +190,5 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
@@ -31 +32 @@
-@@ -204,6 +204,9 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
+@@ -198,6 +198,9 @@ dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
@@ -42 +43 @@
-@@ -283,4 +286,5 @@ dev_uev_handler(__rte_unused void *param)
+@@ -278,4 +281,5 @@ dev_uev_handler(__rte_unused void *param)
@@ -48 +49 @@
-@@ -289,4 +293,5 @@ dev_uev_handler(__rte_unused void *param)
+@@ -284,4 +288,5 @@ dev_uev_handler(__rte_unused void *param)



More information about the stable mailing list