DPDK patches and discussions
 help / color / mirror / Atom feed
From: Li Qiang <liq3ea@gmail.com>
To: Li Qiang <liq3ea@163.com>
Cc: hemant.agrawal@nxp.com, shreyansh.jain@nxp.com, dev@dpdk.org,
	 Li Qiang <liq3ea@gmail.com>
Subject: Re: [dpdk-dev] [PATCH] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool
Date: Tue, 9 Apr 2019 22:57:40 +0800	[thread overview]
Message-ID: <CAKXe6SK39rjMxoHsPvZysNPKaqEuqFAfsPxOVTwemZGLBg2cqw@mail.gmail.com> (raw)
Message-ID: <20190409145740.C_HTiaviw2bBufOY1FIYABpf5wA09W1rrBFNtGcJOc8@z> (raw)
In-Reply-To: <20190409143301.16482-1-liq3ea@163.com>

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

  parent reply	other threads:[~2019-04-09 19:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-09 14:33 Li Qiang
2019-04-09 14:33 ` Li Qiang
2019-04-09 14:57 ` Li Qiang [this message]
2019-04-09 14:57   ` Li Qiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKXe6SK39rjMxoHsPvZysNPKaqEuqFAfsPxOVTwemZGLBg2cqw@mail.gmail.com \
    --to=liq3ea@gmail.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=liq3ea@163.com \
    --cc=shreyansh.jain@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).