* [PATCH v3] net: mana: Fix possible double free in error handling path
@ 2024-06-25 13:03 Ma Ke
2024-06-27 10:40 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Ma Ke @ 2024-06-25 13:03 UTC (permalink / raw)
To: kys, haiyangz, wei.liu, decui, davem, edumazet, kuba, pabeni,
shradhagupta, horms, kotaranov, longli, schakrabarti,
erick.archer, leon
Cc: linux-hyperv, netdev, linux-kernel, Ma Ke
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.
Fixes: a69839d4327d ("net: mana: Add support for auxiliary device")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
Changes in v3:
- added a "Fixes" line as suggested.
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;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v3] net: mana: Fix possible double free in error handling path
2024-06-25 13:03 [PATCH v3] net: mana: Fix possible double free in error handling path Ma Ke
@ 2024-06-27 10:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-27 10:40 UTC (permalink / raw)
To: Ma Ke
Cc: kys, haiyangz, wei.liu, decui, davem, edumazet, kuba, pabeni,
shradhagupta, horms, kotaranov, longli, schakrabarti,
erick.archer, leon, linux-hyperv, netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 25 Jun 2024 21:03:14 +0800 you 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.
>
> Fixes: a69839d4327d ("net: mana: Add support for auxiliary device")
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
>
> [...]
Here is the summary with links:
- [v3] net: mana: Fix possible double free in error handling path
https://git.kernel.org/netdev/net/c/1864b8224195
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] 2+ messages in thread
end of thread, other threads:[~2024-06-27 10:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25 13:03 [PATCH v3] net: mana: Fix possible double free in error handling path Ma Ke
2024-06-27 10:40 ` 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