netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init()
@ 2022-12-07  8:54 Yuan Can
  2022-12-07  9:14 ` Leon Romanovsky
  2022-12-09 11:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Yuan Can @ 2022-12-07  8:54 UTC (permalink / raw)
  To: shshaikh, manishc, GR-Linux-NIC-Dev, davem, edumazet, kuba,
	pabeni, rajesh.borundia, sucheta.chakraborty, leon, netdev
  Cc: yuancan

If vp alloc failed in qlcnic_sriov_init(), all previously allocated vp
needs to be freed.

Fixes: f197a7aa6288 ("qlcnic: VF-PF communication channel implementation")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
Changes in v2:
- free all vp before destroy_workqueue(bc->bc_trans_wq)

 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
index 9282321c2e7f..f9dd50152b1e 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
@@ -221,6 +221,8 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs)
 	return 0;
 
 qlcnic_destroy_async_wq:
+	while (i--)
+		kfree(sriov->vf_info[i].vp);
 	destroy_workqueue(bc->bc_async_wq);
 
 qlcnic_destroy_trans_wq:
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2] drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init()
  2022-12-07  8:54 [PATCH net v2] drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init() Yuan Can
@ 2022-12-07  9:14 ` Leon Romanovsky
  2022-12-09 11:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-12-07  9:14 UTC (permalink / raw)
  To: Yuan Can
  Cc: shshaikh, manishc, GR-Linux-NIC-Dev, davem, edumazet, kuba,
	pabeni, rajesh.borundia, sucheta.chakraborty, netdev

On Wed, Dec 07, 2022 at 08:54:10AM +0000, Yuan Can wrote:
> If vp alloc failed in qlcnic_sriov_init(), all previously allocated vp
> needs to be freed.
> 
> Fixes: f197a7aa6288 ("qlcnic: VF-PF communication channel implementation")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
> Changes in v2:
> - free all vp before destroy_workqueue(bc->bc_trans_wq)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v2] drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init()
  2022-12-07  8:54 [PATCH net v2] drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init() Yuan Can
  2022-12-07  9:14 ` Leon Romanovsky
@ 2022-12-09 11:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-09 11:00 UTC (permalink / raw)
  To: Yuan Can
  Cc: shshaikh, manishc, GR-Linux-NIC-Dev, davem, edumazet, kuba,
	pabeni, rajesh.borundia, sucheta.chakraborty, leon, netdev

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed, 7 Dec 2022 08:54:10 +0000 you wrote:
> If vp alloc failed in qlcnic_sriov_init(), all previously allocated vp
> needs to be freed.
> 
> Fixes: f197a7aa6288 ("qlcnic: VF-PF communication channel implementation")
> Signed-off-by: Yuan Can <yuancan@huawei.com>
> ---
> Changes in v2:
> - free all vp before destroy_workqueue(bc->bc_trans_wq)
> 
> [...]

Here is the summary with links:
  - [net,v2] drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init()
    https://git.kernel.org/netdev/net/c/01de1123322e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-09 11:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-07  8:54 [PATCH net v2] drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init() Yuan Can
2022-12-07  9:14 ` Leon Romanovsky
2022-12-09 11:00 ` patchwork-bot+netdevbpf

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