[dpdk-stable] patch 'bus/fslmc: fix memory leak in secondary process' has been queued to stable release 19.11.4

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Jul 24 13:59:59 CEST 2020


Hi,

FYI, your patch has been queued to stable release 19.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/26/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.

Thanks.

Luca Boccassi

---
>From 9373ca5d89f429cc52bb955b16fb022296254f39 Mon Sep 17 00:00:00 2001
From: Yunjian Wang <wangyunjian at huawei.com>
Date: Fri, 17 Jul 2020 18:50:17 +0800
Subject: [PATCH] bus/fslmc: fix memory leak in secondary process

[ upstream commit 5ce366525a4cafafd965dd1dfd58c35de1c9ffd7 ]

In fslmc_process_mcp(), we allocate memory for 'dev_name' but not
released before return in secondary process. And it is not used
since commit a69f79300262 ("bus/fslmc: support multi VFIO group"),
so it can be removed.

Fixes: e55d0494ab98 ("bus/fslmc: support secondary process")

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
Acked-by: Hemant Agrawal <hemant.agrawal at nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 970969d2b..abf233844 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -730,7 +730,6 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
 {
 	int ret;
 	intptr_t v_addr;
-	char *dev_name = NULL;
 	struct fsl_mc_io dpmng  = {0};
 	struct mc_version mc_ver_info = {0};
 
@@ -741,13 +740,6 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
 		goto cleanup;
 	}
 
-	dev_name = strdup(dev->device.name);
-	if (!dev_name) {
-		DPAA2_BUS_ERR("Unable to allocate MC device name memory");
-		ret = -ENOMEM;
-		goto cleanup;
-	}
-
 	v_addr = vfio_map_mcp_obj(dev->device.name);
 	if (v_addr == (intptr_t)MAP_FAILED) {
 		DPAA2_BUS_ERR("Error mapping region (errno = %d)", errno);
@@ -784,13 +776,9 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
 	}
 	rte_mcp_ptr_list[0] = (void *)v_addr;
 
-	free(dev_name);
 	return 0;
 
 cleanup:
-	if (dev_name)
-		free(dev_name);
-
 	if (rte_mcp_ptr_list) {
 		free(rte_mcp_ptr_list);
 		rte_mcp_ptr_list = NULL;
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-07-24 12:53:54.762675691 +0100
+++ 0161-bus-fslmc-fix-memory-leak-in-secondary-process.patch	2020-07-24 12:53:48.531011006 +0100
@@ -1,15 +1,16 @@
-From 5ce366525a4cafafd965dd1dfd58c35de1c9ffd7 Mon Sep 17 00:00:00 2001
+From 9373ca5d89f429cc52bb955b16fb022296254f39 Mon Sep 17 00:00:00 2001
 From: Yunjian Wang <wangyunjian at huawei.com>
 Date: Fri, 17 Jul 2020 18:50:17 +0800
 Subject: [PATCH] bus/fslmc: fix memory leak in secondary process
 
+[ upstream commit 5ce366525a4cafafd965dd1dfd58c35de1c9ffd7 ]
+
 In fslmc_process_mcp(), we allocate memory for 'dev_name' but not
 released before return in secondary process. And it is not used
 since commit a69f79300262 ("bus/fslmc: support multi VFIO group"),
 so it can be removed.
 
 Fixes: e55d0494ab98 ("bus/fslmc: support secondary process")
-Cc: stable at dpdk.org
 
 Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
 Acked-by: Hemant Agrawal <hemant.agrawal at nxp.com>
@@ -18,10 +19,10 @@
  1 file changed, 12 deletions(-)
 
 diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
-index efe2c43d3..9134ec552 100644
+index 970969d2b..abf233844 100644
 --- a/drivers/bus/fslmc/fslmc_vfio.c
 +++ b/drivers/bus/fslmc/fslmc_vfio.c
-@@ -739,7 +739,6 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
+@@ -730,7 +730,6 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
  {
  	int ret;
  	intptr_t v_addr;
@@ -29,7 +30,7 @@
  	struct fsl_mc_io dpmng  = {0};
  	struct mc_version mc_ver_info = {0};
  
-@@ -750,13 +749,6 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
+@@ -741,13 +740,6 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
  		goto cleanup;
  	}
  
@@ -43,9 +44,9 @@
  	v_addr = vfio_map_mcp_obj(dev->device.name);
  	if (v_addr == (intptr_t)MAP_FAILED) {
  		DPAA2_BUS_ERR("Error mapping region (errno = %d)", errno);
-@@ -793,13 +785,9 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
+@@ -784,13 +776,9 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
  	}
- 	rte_mcp_ptr_list[MC_PORTAL_INDEX] = (void *)v_addr;
+ 	rte_mcp_ptr_list[0] = (void *)v_addr;
  
 -	free(dev_name);
  	return 0;


More information about the stable mailing list