From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-f68.google.com (mail-ot1-f68.google.com [209.85.210.68]) by dpdk.org (Postfix) with ESMTP id 7A2444C8F for ; Tue, 9 Apr 2019 16:58:17 +0200 (CEST) Received: by mail-ot1-f68.google.com with SMTP id c16so15838818otn.4 for ; Tue, 09 Apr 2019 07:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IO0ZoB+oLA409kqE/4skIRNZroN0YQamV3UK4GxYYcg=; b=qpY22wkApXSH7kHEzM+fXBRK6fQNDNrFVdHgdtuzWKDpaczXk7pKgXHNuVH93Ra7Yr egXFmEX7KvZbBIB+8EX6h8RULRUrUKaHtNR7fVEB3u+lR3XrkWzx3nb7OL1WwKEwqiAi QoEDSguD3frfv3eqR9pa0VyC1ZdnJZ7fd21VXxckTAXiUL2lBpuCUkIkyhuTIMRp4mu4 No1TRBUiTdFtamiKjyskbc12CBFFUIu6BHFyVN20kUrYtyJej6mvK6k0OSyKodPdr+lZ t1fG9ZKDxgVBlQN2tKSvpjfTinX37/zkJUc9OXWYQ7AnVcVWUzYMv0lYDB6yN69ECZFx 66Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IO0ZoB+oLA409kqE/4skIRNZroN0YQamV3UK4GxYYcg=; b=JEqmSRorSMIfL1DWFE1SQAukTKQj6YNnApYJ85p8aKLLEHFcD7FM/i58xKtqZmOwu/ rZQF/9zxcJU23dbXO7hGeGNXF2+AeYF8AkWalovfzKTmmSL393LS1jGOAOO8xprXyhyt g38u4Dyzh0z30kcABUECe+8cq4tCAyxnPZKCoFBrwxVnt6pAZylfBtGThMeKfxFhYi9p Smcctg10e8Q3j99QeHEwFlMAPYTuBy+Da5m6CYUicMeSAu6VUh2XiMemSONrMOTm6M4u hOPwETtgmzfmOe9WZ2wW1N6Syf8oFUvUq3RWlof+41JOJKbmgwUnFxdo2LE2FnhUHjGo l9BQ== X-Gm-Message-State: APjAAAWJt958SvRge3r6R/NuycKvxV6E1CWrZEbObyUZY2CkNuVrHEGJ 0hjKczQvHTQJb4OpO6NFbVpmY2kNaaVQx32jPN4= X-Google-Smtp-Source: APXvYqz/lHkf4loQJ6R9PnJ9rjNFB/QOKVVz3ahL3xRdcTMLQb/mWcseL3nagCk/nZ3fI8ZaSKhX1hIahV/LCSAIQb4= X-Received: by 2002:a9d:4a98:: with SMTP id i24mr24358472otf.228.1554821896829; Tue, 09 Apr 2019 07:58:16 -0700 (PDT) MIME-Version: 1.0 References: <20190409143301.16482-1-liq3ea@163.com> In-Reply-To: <20190409143301.16482-1-liq3ea@163.com> From: Li Qiang Date: Tue, 9 Apr 2019 22:57:40 +0800 Message-ID: To: Li Qiang Cc: hemant.agrawal@nxp.com, shreyansh.jain@nxp.com, dev@dpdk.org, Li Qiang X-Mailman-Approved-At: Tue, 09 Apr 2019 21:24:41 +0200 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2019 14:58:17 -0000 Sorry this patch has an error, please see the v2. Thanks, Li Qiang Li Qiang =E4=BA=8E2019=E5=B9=B44=E6=9C=889=E6=97=A5=E5=91= =A8=E4=BA=8C =E4=B8=8B=E5=8D=8810:33=E5=86=99=E9=81=93=EF=BC=9A > 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 > --- > 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 =3D (struct dpaa_bp_info > *)rte_zmalloc(NULL, > sizeof(struct dpaa_bp_info) * > DPAA_MAX_BPOOLS, > RTE_CACHE_LINE_SIZE); > - if (rte_dpaa_bpid_info =3D=3D NULL) > + if (rte_dpaa_bpid_info =3D=3D NULL) { > + bman_free_pool(bp); > return -ENOMEM; > + }; > } > > rte_dpaa_bpid_info[bpid].mp =3D mp; > -- > 2.17.1 > > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6116DA0096 for ; Tue, 9 Apr 2019 21:25:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 217F05A44; Tue, 9 Apr 2019 21:24:56 +0200 (CEST) Received: from mail-ot1-f68.google.com (mail-ot1-f68.google.com [209.85.210.68]) by dpdk.org (Postfix) with ESMTP id 7A2444C8F for ; Tue, 9 Apr 2019 16:58:17 +0200 (CEST) Received: by mail-ot1-f68.google.com with SMTP id c16so15838818otn.4 for ; Tue, 09 Apr 2019 07:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IO0ZoB+oLA409kqE/4skIRNZroN0YQamV3UK4GxYYcg=; b=qpY22wkApXSH7kHEzM+fXBRK6fQNDNrFVdHgdtuzWKDpaczXk7pKgXHNuVH93Ra7Yr egXFmEX7KvZbBIB+8EX6h8RULRUrUKaHtNR7fVEB3u+lR3XrkWzx3nb7OL1WwKEwqiAi QoEDSguD3frfv3eqR9pa0VyC1ZdnJZ7fd21VXxckTAXiUL2lBpuCUkIkyhuTIMRp4mu4 No1TRBUiTdFtamiKjyskbc12CBFFUIu6BHFyVN20kUrYtyJej6mvK6k0OSyKodPdr+lZ t1fG9ZKDxgVBlQN2tKSvpjfTinX37/zkJUc9OXWYQ7AnVcVWUzYMv0lYDB6yN69ECZFx 66Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IO0ZoB+oLA409kqE/4skIRNZroN0YQamV3UK4GxYYcg=; b=JEqmSRorSMIfL1DWFE1SQAukTKQj6YNnApYJ85p8aKLLEHFcD7FM/i58xKtqZmOwu/ rZQF/9zxcJU23dbXO7hGeGNXF2+AeYF8AkWalovfzKTmmSL393LS1jGOAOO8xprXyhyt g38u4Dyzh0z30kcABUECe+8cq4tCAyxnPZKCoFBrwxVnt6pAZylfBtGThMeKfxFhYi9p Smcctg10e8Q3j99QeHEwFlMAPYTuBy+Da5m6CYUicMeSAu6VUh2XiMemSONrMOTm6M4u hOPwETtgmzfmOe9WZ2wW1N6Syf8oFUvUq3RWlof+41JOJKbmgwUnFxdo2LE2FnhUHjGo l9BQ== X-Gm-Message-State: APjAAAWJt958SvRge3r6R/NuycKvxV6E1CWrZEbObyUZY2CkNuVrHEGJ 0hjKczQvHTQJb4OpO6NFbVpmY2kNaaVQx32jPN4= X-Google-Smtp-Source: APXvYqz/lHkf4loQJ6R9PnJ9rjNFB/QOKVVz3ahL3xRdcTMLQb/mWcseL3nagCk/nZ3fI8ZaSKhX1hIahV/LCSAIQb4= X-Received: by 2002:a9d:4a98:: with SMTP id i24mr24358472otf.228.1554821896829; Tue, 09 Apr 2019 07:58:16 -0700 (PDT) MIME-Version: 1.0 References: <20190409143301.16482-1-liq3ea@163.com> In-Reply-To: <20190409143301.16482-1-liq3ea@163.com> From: Li Qiang Date: Tue, 9 Apr 2019 22:57:40 +0800 Message-ID: To: Li Qiang Cc: hemant.agrawal@nxp.com, shreyansh.jain@nxp.com, dev@dpdk.org, Li Qiang X-Mailman-Approved-At: Tue, 09 Apr 2019 21:24:41 +0200 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] drivers: dpaa: fix 'bman_pool' leak in dpaa_mbuf_create_pool X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190409145740.C_HTiaviw2bBufOY1FIYABpf5wA09W1rrBFNtGcJOc8@z> Sorry this patch has an error, please see the v2. Thanks, Li Qiang Li Qiang =E4=BA=8E2019=E5=B9=B44=E6=9C=889=E6=97=A5=E5=91= =A8=E4=BA=8C =E4=B8=8B=E5=8D=8810:33=E5=86=99=E9=81=93=EF=BC=9A > 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 > --- > 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 =3D (struct dpaa_bp_info > *)rte_zmalloc(NULL, > sizeof(struct dpaa_bp_info) * > DPAA_MAX_BPOOLS, > RTE_CACHE_LINE_SIZE); > - if (rte_dpaa_bpid_info =3D=3D NULL) > + if (rte_dpaa_bpid_info =3D=3D NULL) { > + bman_free_pool(bp); > return -ENOMEM; > + }; > } > > rte_dpaa_bpid_info[bpid].mp =3D mp; > -- > 2.17.1 > > >