[dpdk-stable] patch 'app/testpmd: fix buffer leak in TM command' has been queued to LTS release 17.11.4

Yongseok Koh yskoh at mellanox.com
Fri Jul 27 04:31:05 CEST 2018


Hi,

FYI, your patch has been queued to LTS release 17.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/28/18. So please
shout if anyone has objections.

Thanks.

Yongseok

---
>From fd417e1a22343c69844cc70417e7a6e3cf6228c4 Mon Sep 17 00:00:00 2001
From: Nithin Dabilpuram <nithin.dabilpuram at caviumnetworks.com>
Date: Thu, 5 Jul 2018 11:15:46 +0530
Subject: [PATCH] app/testpmd: fix buffer leak in TM command

[ upstream commit b23ee8f2ac5de4a52573f844ba3c4f3261c3f7e7 ]

Free the buffer allocated for shared_shaper_id array in
case of configuration without shared shapers.

Fixes: 996cb153af06 ("app/testpmd: add commands for TM nodes and hierarchy commit")

Signed-off-by: Nithin Dabilpuram <nithin.dabilpuram at caviumnetworks.com>
Acked-by: Jasvinder Singh <jasvinder.singh at intel.com>
---
 app/test-pmd/cmdline_tm.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index 803fae444..d40a427d8 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -1624,10 +1624,12 @@ static void cmd_add_port_tm_nonleaf_node_parsed(void *parsed_result,
 
 	np.shaper_profile_id = res->shaper_profile_id;
 	np.n_shared_shapers = n_shared_shapers;
-	if (np.n_shared_shapers)
+	if (np.n_shared_shapers) {
 		np.shared_shaper_id = &shared_shaper_id[0];
-	else
-		np.shared_shaper_id = NULL;
+	} else {
+		free(shared_shaper_id);
+		shared_shaper_id = NULL;
+	}
 
 	np.nonleaf.n_sp_priorities = res->n_sp_priorities;
 	np.stats_mask = res->stats_mask;
@@ -1779,10 +1781,12 @@ static void cmd_add_port_tm_leaf_node_parsed(void *parsed_result,
 	np.shaper_profile_id = res->shaper_profile_id;
 	np.n_shared_shapers = n_shared_shapers;
 
-	if (np.n_shared_shapers)
+	if (np.n_shared_shapers) {
 		np.shared_shaper_id = &shared_shaper_id[0];
-	else
-		np.shared_shaper_id = NULL;
+	} else {
+		free(shared_shaper_id);
+		shared_shaper_id = NULL;
+	}
 
 	np.leaf.cman = res->cman_mode;
 	np.leaf.wred.wred_profile_id = res->wred_profile_id;
-- 
2.11.0



More information about the stable mailing list