[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y5BHPCE5rfQ0cmne@unreal>
Date: Wed, 7 Dec 2022 09:56:44 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Yuan Can <yuancan@...wei.com>
Cc: shshaikh@...vell.com, manishc@...vell.com,
GR-Linux-NIC-Dev@...vell.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
sucheta.chakraborty@...gic.com, rajesh.borundia@...gic.com,
netdev@...r.kernel.org
Subject: Re: [PATCH net] drivers: net: qlcnic: Fix potential memory leak in
qlcnic_sriov_init()
On Tue, Dec 06, 2022 at 10:30:31AM +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@...wei.com>
> ---
> 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..d0470c62e1b2 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
> @@ -222,6 +222,8 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs)
>
> qlcnic_destroy_async_wq:
> destroy_workqueue(bc->bc_async_wq);
> + while (i--)
> + kfree(sriov->vf_info[i].vp);
These lines should be before destroy_workqueue(bc->bc_async_wq);
Thanks
>
> qlcnic_destroy_trans_wq:
> destroy_workqueue(bc->bc_trans_wq);
> --
> 2.17.1
>
Powered by blists - more mailing lists