* [PATCH] net: qcom/emac: fix UAF in emac_remove
@ 2021-07-09 14:24 Pavel Skripkin
2021-07-09 18:30 ` patchwork-bot+netdevbpf
2021-07-10 5:02 ` Timur Tabi
0 siblings, 2 replies; 5+ messages in thread
From: Pavel Skripkin @ 2021-07-09 14:24 UTC (permalink / raw)
To: timur, davem, kuba; +Cc: netdev, linux-kernel, Pavel Skripkin
adpt is netdev private data and it cannot be
used after free_netdev() call. Using adpt after free_netdev()
can cause UAF bug. Fix it by moving free_netdev() at the end of the
function.
Fixes: 54e19bc74f33 ("net: qcom/emac: do not use devm on internal phy pdev")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
drivers/net/ethernet/qualcomm/emac/emac.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
index 8543bf3c3484..ad655f0a4965 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac.c
@@ -735,12 +735,13 @@ static int emac_remove(struct platform_device *pdev)
put_device(&adpt->phydev->mdio.dev);
mdiobus_unregister(adpt->mii_bus);
- free_netdev(netdev);
if (adpt->phy.digital)
iounmap(adpt->phy.digital);
iounmap(adpt->phy.base);
+ free_netdev(netdev);
+
return 0;
}
--
2.32.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: qcom/emac: fix UAF in emac_remove
2021-07-09 14:24 [PATCH] net: qcom/emac: fix UAF in emac_remove Pavel Skripkin
@ 2021-07-09 18:30 ` patchwork-bot+netdevbpf
2021-07-10 5:02 ` Timur Tabi
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-07-09 18:30 UTC (permalink / raw)
To: Pavel Skripkin; +Cc: timur, davem, kuba, netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Fri, 9 Jul 2021 17:24:18 +0300 you wrote:
> adpt is netdev private data and it cannot be
> used after free_netdev() call. Using adpt after free_netdev()
> can cause UAF bug. Fix it by moving free_netdev() at the end of the
> function.
>
> Fixes: 54e19bc74f33 ("net: qcom/emac: do not use devm on internal phy pdev")
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
>
> [...]
Here is the summary with links:
- net: qcom/emac: fix UAF in emac_remove
https://git.kernel.org/netdev/net/c/ad297cd2db89
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] 5+ messages in thread
* Re: [PATCH] net: qcom/emac: fix UAF in emac_remove
2021-07-09 14:24 [PATCH] net: qcom/emac: fix UAF in emac_remove Pavel Skripkin
2021-07-09 18:30 ` patchwork-bot+netdevbpf
@ 2021-07-10 5:02 ` Timur Tabi
2021-07-10 6:57 ` Pavel Skripkin
1 sibling, 1 reply; 5+ messages in thread
From: Timur Tabi @ 2021-07-10 5:02 UTC (permalink / raw)
To: Pavel Skripkin; +Cc: timur, David Miller, kuba, netdev, lkml
On Fri, Jul 9, 2021 at 9:24 AM Pavel Skripkin <paskripkin@gmail.com> wrote:
>
> adpt is netdev private data and it cannot be
> used after free_netdev() call. Using adpt after free_netdev()
> can cause UAF bug. Fix it by moving free_netdev() at the end of the
> function.
Please spell out what "UAF" means, thanks. If you fix that, then
Acked-by: Timur Tabi <timur@kernel.org>
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: qcom/emac: fix UAF in emac_remove
2021-07-10 5:02 ` Timur Tabi
@ 2021-07-10 6:57 ` Pavel Skripkin
2021-07-10 15:20 ` Timur Tabi
0 siblings, 1 reply; 5+ messages in thread
From: Pavel Skripkin @ 2021-07-10 6:57 UTC (permalink / raw)
To: Timur Tabi; +Cc: David Miller, kuba, netdev, lkml
On Sat, 10 Jul 2021 00:02:26 -0500
Timur Tabi <timur@kernel.org> wrote:
> On Fri, Jul 9, 2021 at 9:24 AM Pavel Skripkin <paskripkin@gmail.com>
> wrote:
> >
> > adpt is netdev private data and it cannot be
> > used after free_netdev() call. Using adpt after free_netdev()
> > can cause UAF bug. Fix it by moving free_netdev() at the end of the
> > function.
>
> Please spell out what "UAF" means, thanks. If you fix that, then
>
> Acked-by: Timur Tabi <timur@kernel.org>
>
> Thanks.
Hi, Timur!
Thank you for feedback.
David has already applied this pacth. So, should I send v2 or maybe
revert + v2? I haven't been in such situations yet :)
With regards,
Pavel Skripkin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: qcom/emac: fix UAF in emac_remove
2021-07-10 6:57 ` Pavel Skripkin
@ 2021-07-10 15:20 ` Timur Tabi
0 siblings, 0 replies; 5+ messages in thread
From: Timur Tabi @ 2021-07-10 15:20 UTC (permalink / raw)
To: Pavel Skripkin; +Cc: Timur Tabi, David Miller, kuba, netdev, lkml
On Sat, Jul 10, 2021 at 1:57 AM Pavel Skripkin <paskripkin@gmail.com> wrote:
> David has already applied this pacth. So, should I send v2 or maybe
> revert + v2? I haven't been in such situations yet :)
No, don't worry about it.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-10 15:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 14:24 [PATCH] net: qcom/emac: fix UAF in emac_remove Pavel Skripkin
2021-07-09 18:30 ` patchwork-bot+netdevbpf
2021-07-10 5:02 ` Timur Tabi
2021-07-10 6:57 ` Pavel Skripkin
2021-07-10 15:20 ` Timur Tabi
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).