From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yskoh@mellanox.com>
Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])
 by dpdk.org (Postfix) with ESMTP id 56C831B50A
 for <stable@dpdk.org>; Fri, 30 Nov 2018 00:15:01 +0100 (CET)
Received: from Internal Mail-Server by MTLPINE1 (envelope-from
 yskoh@mellanox.com)
 with ESMTPS (AES256-SHA encrypted); 30 Nov 2018 01:20:50 +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 wATNCW8O032075;
 Fri, 30 Nov 2018 01:14:54 +0200
From: Yongseok Koh <yskoh@mellanox.com>
To: Ziye Yang <ziye.yang@intel.com>
Cc: Ferruh Yigit <ferruh.yigit@intel.com>, dpdk stable <stable@dpdk.org>
Date: Thu, 29 Nov 2018 15:11:18 -0800
Message-Id: <20181129231202.30436-84-yskoh@mellanox.com>
X-Mailer: git-send-email 2.11.0
In-Reply-To: <20181129231202.30436-1-yskoh@mellanox.com>
References: <20181129231202.30436-1-yskoh@mellanox.com>
Subject: [dpdk-stable] patch 'eal/linux: fix memory leak of logid' has been
	queued to LTS release 17.11.5
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Nov 2018 23:15:01 -0000

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@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@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@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@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@dpdk.org
 
 Signed-off-by: Ziye Yang <ziye.yang@intel.com>
 Reviewed-by: Ferruh Yigit <ferruh.yigit@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;
  	}