DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool
@ 2019-04-09 14:56 Li Qiang
  2019-04-09 14:56 ` Li Qiang
  2019-07-04 15:22 ` Thomas Monjalon
  0 siblings, 2 replies; 5+ messages in thread
From: Li Qiang @ 2019-04-09 14:56 UTC (permalink / raw)
  To: hemant.agrawal, shreyansh.jain; +Cc: dev, liq3ea, Li Qiang

When 'rte_zmalloc' failed dpaa_mbuf_create_pool() forgets freeing
'bp' thus leading resource leak. This patch avoids this.

Spotted by Coverity: CID 337679

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 drivers/mempool/dpaa/dpaa_mempool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c
index 003081772..54cdf37e8 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.c
+++ b/drivers/mempool/dpaa/dpaa_mempool.c
@@ -78,8 +78,10 @@ dpaa_mbuf_create_pool(struct rte_mempool *mp)
 		rte_dpaa_bpid_info = (struct dpaa_bp_info *)rte_zmalloc(NULL,
 				sizeof(struct dpaa_bp_info) * DPAA_MAX_BPOOLS,
 				RTE_CACHE_LINE_SIZE);
-		if (rte_dpaa_bpid_info == NULL)
+		if (rte_dpaa_bpid_info == NULL) {
+			bman_free_pool(bp);
 			return -ENOMEM;
+		}
 	}
 
 	rte_dpaa_bpid_info[bpid].mp = mp;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v2] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool
  2019-04-09 14:56 [dpdk-dev] [PATCH v2] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool Li Qiang
@ 2019-04-09 14:56 ` Li Qiang
  2019-07-04 15:22 ` Thomas Monjalon
  1 sibling, 0 replies; 5+ messages in thread
From: Li Qiang @ 2019-04-09 14:56 UTC (permalink / raw)
  To: hemant.agrawal, shreyansh.jain; +Cc: dev, liq3ea, Li Qiang

When 'rte_zmalloc' failed dpaa_mbuf_create_pool() forgets freeing
'bp' thus leading resource leak. This patch avoids this.

Spotted by Coverity: CID 337679

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 drivers/mempool/dpaa/dpaa_mempool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c
index 003081772..54cdf37e8 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.c
+++ b/drivers/mempool/dpaa/dpaa_mempool.c
@@ -78,8 +78,10 @@ dpaa_mbuf_create_pool(struct rte_mempool *mp)
 		rte_dpaa_bpid_info = (struct dpaa_bp_info *)rte_zmalloc(NULL,
 				sizeof(struct dpaa_bp_info) * DPAA_MAX_BPOOLS,
 				RTE_CACHE_LINE_SIZE);
-		if (rte_dpaa_bpid_info == NULL)
+		if (rte_dpaa_bpid_info == NULL) {
+			bman_free_pool(bp);
 			return -ENOMEM;
+		}
 	}
 
 	rte_dpaa_bpid_info[bpid].mp = mp;
-- 
2.17.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool
  2019-04-09 14:56 [dpdk-dev] [PATCH v2] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool Li Qiang
  2019-04-09 14:56 ` Li Qiang
@ 2019-07-04 15:22 ` Thomas Monjalon
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2019-07-04 15:22 UTC (permalink / raw)
  To: Li Qiang; +Cc: dev, hemant.agrawal, shreyansh.jain, liq3ea, akhil.goyal

09/04/2019 16:56, Li Qiang:
> When 'rte_zmalloc' failed dpaa_mbuf_create_pool() forgets freeing
> 'bp' thus leading resource leak. This patch avoids this.
> 
> Spotted by Coverity: CID 337679
> 
> Signed-off-by: Li Qiang <liq3ea@163.com>

Applied, thanks

Sorry for the delay, I missed the ack from Hemant which was
not threaded and not in patchwork.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool
@ 2019-04-10 10:03 Hemant Agrawal
  2019-04-10 10:03 ` Hemant Agrawal
  0 siblings, 1 reply; 5+ messages in thread
From: Hemant Agrawal @ 2019-04-10 10:03 UTC (permalink / raw)
  To: Li Qiang, Shreyansh Jain; +Cc: dev, liq3ea

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool
  2019-04-10 10:03 Hemant Agrawal
@ 2019-04-10 10:03 ` Hemant Agrawal
  0 siblings, 0 replies; 5+ messages in thread
From: Hemant Agrawal @ 2019-04-10 10:03 UTC (permalink / raw)
  To: Li Qiang, Shreyansh Jain; +Cc: dev, liq3ea

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-04 15:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09 14:56 [dpdk-dev] [PATCH v2] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool Li Qiang
2019-04-09 14:56 ` Li Qiang
2019-07-04 15:22 ` Thomas Monjalon
2019-04-10 10:03 Hemant Agrawal
2019-04-10 10:03 ` Hemant Agrawal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).