[dpdk-stable] patch 'eal/linux: fix memory leak of logid' has been queued to LTS release 17.11.5

Yongseok Koh yskoh at mellanox.com
Fri Nov 30 00:11:18 CET 2018


Hi,

FYI, your patch has been queued to LTS release 17.11.5

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/01/18. 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. 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 f6f4b11b7fbc102ecce3a855cfc4ad252c62743c Mon Sep 17 00:00:00 2001
From: Ziye Yang <ziye.yang at intel.com>
Date: Wed, 12 Sep 2018 09:31:50 +0800
Subject: [PATCH] eal/linux: fix memory leak of logid

[ upstream commit e4f2c1421d8036a4778c43bf25201ef5fb37ad6f ]

This patch is used to fix the memory leak issue of logid.
We use the ASAN test in SPDK when integrating DPDK and
find this memory leak issue.

Fixes: d8a2bc71dfc2 ("log: remove app path from syslog id")

Signed-off-by: Ziye Yang <ziye.yang at intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 lib/librte_eal/linuxapp/eal/eal.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 229eec9f1..e6a733138 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -743,7 +743,8 @@ rte_eal_init(int argc, char **argv)
 	int i, fctret, ret;
 	pthread_t thread_id;
 	static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0);
-	const char *logid;
+	const char *p;
+	static char logid[PATH_MAX];
 	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
 	char thread_name[RTE_MAX_THREAD_NAME_LEN];
 
@@ -760,9 +761,8 @@ rte_eal_init(int argc, char **argv)
 		return -1;
 	}
 
-	logid = strrchr(argv[0], '/');
-	logid = strdup(logid ? logid + 1: argv[0]);
-
+	p = strrchr(argv[0], '/');
+	strlcpy(logid, p ? p + 1 : argv[0], sizeof(logid));
 	thread_id = pthread_self();
 
 	eal_reset_internal_config(&internal_config);
-- 
2.11.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2018-11-29 15:01:48.930326659 -0800
+++ 0084-eal-linux-fix-memory-leak-of-logid.patch	2018-11-29 15:01:45.232961000 -0800
@@ -1,14 +1,15 @@
-From e4f2c1421d8036a4778c43bf25201ef5fb37ad6f Mon Sep 17 00:00:00 2001
+From f6f4b11b7fbc102ecce3a855cfc4ad252c62743c Mon Sep 17 00:00:00 2001
 From: Ziye Yang <ziye.yang at intel.com>
 Date: Wed, 12 Sep 2018 09:31:50 +0800
 Subject: [PATCH] eal/linux: fix memory leak of logid
 
+[ upstream commit e4f2c1421d8036a4778c43bf25201ef5fb37ad6f ]
+
 This patch is used to fix the memory leak issue of logid.
 We use the ASAN test in SPDK when integrating DPDK and
 find this memory leak issue.
 
 Fixes: d8a2bc71dfc2 ("log: remove app path from syslog id")
-Cc: stable at dpdk.org
 
 Signed-off-by: Ziye Yang <ziye.yang at intel.com>
 Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
@@ -17,10 +18,10 @@
  1 file changed, 4 insertions(+), 4 deletions(-)
 
 diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
-index 7b11375f4..67116eee2 100644
+index 229eec9f1..e6a733138 100644
 --- a/lib/librte_eal/linuxapp/eal/eal.c
 +++ b/lib/librte_eal/linuxapp/eal/eal.c
-@@ -825,7 +825,8 @@ rte_eal_init(int argc, char **argv)
+@@ -743,7 +743,8 @@ rte_eal_init(int argc, char **argv)
  	int i, fctret, ret;
  	pthread_t thread_id;
  	static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0);
@@ -30,7 +31,7 @@
  	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
  	char thread_name[RTE_MAX_THREAD_NAME_LEN];
  
-@@ -842,9 +843,8 @@ rte_eal_init(int argc, char **argv)
+@@ -760,9 +761,8 @@ rte_eal_init(int argc, char **argv)
  		return -1;
  	}
  


More information about the stable mailing list