From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Ziyang Xuan <william.xuanziyang@huawei.com>
Cc: <sgoutham@marvell.com>, <gakula@marvell.com>,
<sbhatta@marvell.com>, <hkelam@marvell.com>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <netdev@vger.kernel.org>,
<naveenm@marvell.com>, <rsaladi2@marvell.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net 1/2] octeontx2-pf: Fix possible memory leak in otx2_probe()
Date: Fri, 25 Nov 2022 14:46:05 +0100 [thread overview]
Message-ID: <Y4DHHUUbGl5wWGQ+@boxer> (raw)
In-Reply-To: <e024450cf08f469fb1e0153b78a04a54829dfddb.1669253985.git.william.xuanziyang@huawei.com>
On Thu, Nov 24, 2022 at 09:56:43AM +0800, Ziyang Xuan wrote:
> In otx2_probe(), there are several possible memory leak bugs
> in exception paths as follows:
> 1. Do not release pf->otx2_wq when excute otx2_init_tc() failed.
> 2. Do not shutdown tc when excute otx2_register_dl() failed.
> 3. Do not unregister devlink when initialize SR-IOV failed.
>
> Fixes: 1d4d9e42c240 ("octeontx2-pf: Add tc flower hardware offload on ingress traffic")
> Fixes: 2da489432747 ("octeontx2-pf: devlink params support to set mcam entry count")
> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
> ---
> drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> index 303930499a4c..8d7f2c3b0cfd 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
> @@ -2900,7 +2900,7 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>
> err = otx2_register_dl(pf);
> if (err)
> - goto err_mcam_flow_del;
> + goto err_register_dl;
>
> /* Initialize SR-IOV resources */
> err = otx2_sriov_vfcfg_init(pf);
> @@ -2919,8 +2919,11 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> return 0;
If otx2_dcbnl_set_ops() fails at the end then shouldn't we also call
otx2_sriov_vfcfg_cleanup() ?
>
> err_pf_sriov_init:
> + otx2_unregister_dl(pf);
> +err_register_dl:
> otx2_shutdown_tc(pf);
> err_mcam_flow_del:
> + destroy_workqueue(pf->otx2_wq);
> otx2_mcam_flow_del(pf);
> err_unreg_netdev:
> unregister_netdev(netdev);
> --
> 2.25.1
>
next prev parent reply other threads:[~2022-11-25 13:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-24 1:56 [PATCH net 0/2] octeontx2: Fix several bugs in exception paths Ziyang Xuan
2022-11-24 1:56 ` [PATCH net 1/2] octeontx2-pf: Fix possible memory leak in otx2_probe() Ziyang Xuan
2022-11-25 13:46 ` Maciej Fijalkowski [this message]
2022-11-26 1:04 ` Ziyang Xuan (William)
2022-12-02 1:44 ` Ziyang Xuan (William)
2022-12-02 6:38 ` [EXT] " Geethasowjanya Akula
2022-12-02 8:34 ` Ziyang Xuan (William)
2022-12-02 9:50 ` Geethasowjanya Akula
2022-11-24 1:56 ` [PATCH net 2/2] octeontx2-vf: Fix possible memory leak in otx2vf_probe() Ziyang Xuan
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=Y4DHHUUbGl5wWGQ+@boxer \
--to=maciej.fijalkowski@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gakula@marvell.com \
--cc=hkelam@marvell.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=naveenm@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rsaladi2@marvell.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.com \
--cc=william.xuanziyang@huawei.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