From: Leon Romanovsky <leon@kernel.org>
To: Yuan Can <yuancan@huawei.com>
Cc: intel-wired-lan@lists.osuosl.org, jesse.brandeburg@intel.com,
edumazet@google.com, netdev@vger.kernel.org,
anthony.l.nguyen@intel.com, jeffrey.t.kirsher@intel.com,
piotr.marczak@intel.com, kuba@kernel.org, pabeni@redhat.com,
davem@davemloft.net
Subject: Re: [Intel-wired-lan] [PATCH] intel/i40e: Fix potential memory leak in i40e_init_recovery_mode()
Date: Tue, 6 Dec 2022 12:02:35 +0200 [thread overview]
Message-ID: <Y48TO7s0K9J0kVh0@unreal> (raw)
In-Reply-To: <20221206092613.122952-1-yuancan@huawei.com>
On Tue, Dec 06, 2022 at 09:26:13AM +0000, Yuan Can wrote:
> If i40e_vsi_mem_alloc() failed in i40e_init_recovery_mode(), the pf will be
> freed with the pf->vsi leaked.
> Fix by free pf->vsi in the error handling path.
>
> Fixes: 4ff0ee1af016 ("i40e: Introduce recovery mode support")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
> drivers/net/ethernet/intel/i40e/i40e_main.c | 1 +
> 1 file changed, 1 insertion(+)
The patch title needs to be "[PATCH net]..."
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index b5dcd15ced36..d23081c224d6 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -15536,6 +15536,7 @@ static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw)
> pci_disable_pcie_error_reporting(pf->pdev);
> pci_release_mem_regions(pf->pdev);
> pci_disable_device(pf->pdev);
> + kfree(pf->vsi);
> kfree(pf);
>
> return err;
The change is ok, but it is worth to cleanup error flow of i40e_probe and i40e_remove
as they are not really in the same order.
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
WARNING: multiple messages have this Message-ID (diff)
From: Leon Romanovsky <leon@kernel.org>
To: Yuan Can <yuancan@huawei.com>
Cc: jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, jeffrey.t.kirsher@intel.com,
alice.michael@intel.com, piotr.marczak@intel.com,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org
Subject: Re: [PATCH] intel/i40e: Fix potential memory leak in i40e_init_recovery_mode()
Date: Tue, 6 Dec 2022 12:02:35 +0200 [thread overview]
Message-ID: <Y48TO7s0K9J0kVh0@unreal> (raw)
In-Reply-To: <20221206092613.122952-1-yuancan@huawei.com>
On Tue, Dec 06, 2022 at 09:26:13AM +0000, Yuan Can wrote:
> If i40e_vsi_mem_alloc() failed in i40e_init_recovery_mode(), the pf will be
> freed with the pf->vsi leaked.
> Fix by free pf->vsi in the error handling path.
>
> Fixes: 4ff0ee1af016 ("i40e: Introduce recovery mode support")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
> drivers/net/ethernet/intel/i40e/i40e_main.c | 1 +
> 1 file changed, 1 insertion(+)
The patch title needs to be "[PATCH net]..."
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index b5dcd15ced36..d23081c224d6 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -15536,6 +15536,7 @@ static int i40e_init_recovery_mode(struct i40e_pf *pf, struct i40e_hw *hw)
> pci_disable_pcie_error_reporting(pf->pdev);
> pci_release_mem_regions(pf->pdev);
> pci_disable_device(pf->pdev);
> + kfree(pf->vsi);
> kfree(pf);
>
> return err;
The change is ok, but it is worth to cleanup error flow of i40e_probe and i40e_remove
as they are not really in the same order.
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
next prev parent reply other threads:[~2022-12-06 10:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 9:26 [Intel-wired-lan] [PATCH] intel/i40e: Fix potential memory leak in i40e_init_recovery_mode() Yuan Can
2022-12-06 9:26 ` Yuan Can
2022-12-06 10:02 ` Leon Romanovsky [this message]
2022-12-06 10:02 ` Leon Romanovsky
2022-12-06 10:28 ` [Intel-wired-lan] " Yuan Can
2022-12-06 10:28 ` Yuan Can
2022-12-06 10:28 ` [Intel-wired-lan] " Jiri Pirko
2022-12-06 10:28 ` Jiri Pirko
2022-12-06 11:34 ` [Intel-wired-lan] " Yuan Can
2022-12-06 11:34 ` Yuan Can
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=Y48TO7s0K9J0kVh0@unreal \
--to=leon@kernel.org \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=piotr.marczak@intel.com \
--cc=yuancan@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.