DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool
@ 2019-04-09 14:33 Li Qiang
  2019-04-09 14:33 ` Li Qiang
  2019-04-09 14:57 ` Li Qiang
  0 siblings, 2 replies; 4+ messages in thread
From: Li Qiang @ 2019-04-09 14:33 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..3d5c0022c 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] 4+ messages in thread

* [dpdk-dev] [PATCH] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool
  2019-04-09 14:33 [dpdk-dev] [PATCH] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool Li Qiang
@ 2019-04-09 14:33 ` Li Qiang
  2019-04-09 14:57 ` Li Qiang
  1 sibling, 0 replies; 4+ messages in thread
From: Li Qiang @ 2019-04-09 14:33 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..3d5c0022c 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] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool
  2019-04-09 14:33 [dpdk-dev] [PATCH] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool Li Qiang
  2019-04-09 14:33 ` Li Qiang
@ 2019-04-09 14:57 ` Li Qiang
  2019-04-09 14:57   ` Li Qiang
  1 sibling, 1 reply; 4+ messages in thread
From: Li Qiang @ 2019-04-09 14:57 UTC (permalink / raw)
  To: Li Qiang; +Cc: hemant.agrawal, shreyansh.jain, dev, Li Qiang

Sorry this patch has an error, please see the v2.

Thanks,
Li Qiang

Li Qiang <liq3ea@163.com> 于2019年4月9日周二 下午10:33写道:

> 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..3d5c0022c 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] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool
  2019-04-09 14:57 ` Li Qiang
@ 2019-04-09 14:57   ` Li Qiang
  0 siblings, 0 replies; 4+ messages in thread
From: Li Qiang @ 2019-04-09 14:57 UTC (permalink / raw)
  To: Li Qiang; +Cc: hemant.agrawal, shreyansh.jain, dev, Li Qiang

Sorry this patch has an error, please see the v2.

Thanks,
Li Qiang

Li Qiang <liq3ea@163.com> 于2019年4月9日周二 下午10:33写道:

> 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..3d5c0022c 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] 4+ messages in thread

end of thread, other threads:[~2019-04-09 19:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-09 14:33 [dpdk-dev] [PATCH] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool Li Qiang
2019-04-09 14:33 ` Li Qiang
2019-04-09 14:57 ` Li Qiang
2019-04-09 14:57   ` Li Qiang

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).