[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <08bbd282-081f-433f-8b23-ba1cf7d95110@intel.com>
Date: Tue, 25 Jun 2024 11:13:41 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Ma Ke <make24@...as.ac.cn>
CC: <linux-hyperv@...r.kernel.org>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <kys@...rosoft.com>,
<haiyangz@...rosoft.com>, <wei.liu@...nel.org>, <decui@...rosoft.com>,
<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>, <shradhagupta@...ux.microsoft.com>, <horms@...nel.org>,
<kotaranov@...rosoft.com>, <schakrabarti@...ux.microsoft.com>,
<erick.archer@...look.com>
Subject: Re: [PATCH v2] net: mana: Fix possible double free in error handling
path
On 6/25/24 10:38, Ma Ke wrote:
> When auxiliary_device_add() returns error and then calls
> auxiliary_device_uninit(), callback function adev_release
> calls kfree(madev). We shouldn't call kfree(madev) again
> in the error handling path. Set 'madev' to NULL.
>
> Signed-off-by: Ma Ke <make24@...as.ac.cn>
> ---
> Changes in v2:
> - streamlined the patch according suggestions;
> - revised the description.
> ---
> drivers/net/ethernet/microsoft/mana/mana_en.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index d087cf954f75..608ad31a9702 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -2798,6 +2798,8 @@ static int add_adev(struct gdma_dev *gd)
> if (ret)
> goto init_fail;
>
> + /* madev is owned by the auxiliary device */
> + madev = NULL;
> ret = auxiliary_device_add(adev);
> if (ret)
> goto add_fail;
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
Powered by blists - more mailing lists