From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C4817A0A02 for ; Mon, 17 May 2021 18:14:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BE71941101; Mon, 17 May 2021 18:14:41 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by mails.dpdk.org (Postfix) with ESMTP id CCF5440041 for ; Mon, 17 May 2021 18:14:40 +0200 (CEST) Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=Keschdeichel.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lift8-000853-Sq; Mon, 17 May 2021 16:14:38 +0000 From: Christian Ehrhardt To: Xueming Li Cc: Gaetan Rivet , dpdk stable Date: Mon, 17 May 2021 18:08:52 +0200 Message-Id: <20210517161039.3132619-103-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517161039.3132619-1-christian.ehrhardt@canonical.com> References: <20210517161039.3132619-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'devargs: fix memory leak on parsing failure' has been queued to stable release 19.11.9 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/19/21. 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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/4dc48d766c3ab8076786266d1bb6cfe1cd03d25c Thanks. Christian Ehrhardt --- >From 4dc48d766c3ab8076786266d1bb6cfe1cd03d25c Mon Sep 17 00:00:00 2001 From: Xueming Li Date: Tue, 13 Apr 2021 03:14:09 +0000 Subject: [PATCH] devargs: fix memory leak on parsing failure [ upstream commit e132ee8690474fa985e26f1d4db75823024748c8 ] This patch fixes memory leak in parsing error handling. Fixes: 338327d731e6 ("devargs: add function to parse device layers") Signed-off-by: Xueming Li Reviewed-by: Gaetan Rivet --- lib/librte_eal/common/eal_common_devargs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index 2123773ef8..0e350bc3ce 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -60,6 +60,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs, size_t nblayer; size_t i = 0; int ret = 0; + bool allocated_data = false; /* Split each sub-lists. */ nblayer = devargs_layer_count(devstr); @@ -81,6 +82,7 @@ rte_devargs_layers_parse(struct rte_devargs *devargs, ret = -ENOMEM; goto get_out; } + allocated_data = true; s = devargs->data; } @@ -163,8 +165,14 @@ get_out: if (layers[i].kvlist) rte_kvargs_free(layers[i].kvlist); } - if (ret != 0) + if (ret != 0) { + if (allocated_data) { + /* Free duplicated data. */ + free(devargs->data); + devargs->data = NULL; + } rte_errno = -ret; + } return ret; } -- 2.31.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-17 17:40:33.492661267 +0200 +++ 0103-devargs-fix-memory-leak-on-parsing-failure.patch 2021-05-17 17:40:29.307810548 +0200 @@ -1 +1 @@ -From e132ee8690474fa985e26f1d4db75823024748c8 Mon Sep 17 00:00:00 2001 +From 4dc48d766c3ab8076786266d1bb6cfe1cd03d25c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e132ee8690474fa985e26f1d4db75823024748c8 ] + @@ -9 +10,0 @@ -Cc: stable@dpdk.org @@ -18 +19 @@ -index 48f85ee9c0..e40b91ea66 100644 +index 2123773ef8..0e350bc3ce 100644