Skip to contentSkip to conversation

net: ti: fix UAF in tlan_remove_one

PATCH Applied Pavel Skripkin 2 participants 2 messages Jul 9, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ti: fix UAF in tlan_remove_one

priv is netdev private data and it cannot be
used after free_netdev() call. Using priv after free_netdev() can cause UAF bug. Fix it by moving free_netdev() at the end of the function.

Fixes 1e0a8b13d355 ("tlan: cancel work at remove path")
---
 drivers/net/ethernet/ti/tlan.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/ti/tlan.c +1 -2
index 0b2ce4bdc2c3..e0cb713193ea 100644
@@ -313,9 +313,8 @@ static void tlan_remove_one(struct pci_dev *pdev)
 	pci_release_regions(pdev);
 #endif
 
-	free_netdev(dev);
-
 	cancel_work_sync(&priv->tlan_tqueue);
+	free_netdev(dev);
 }
 
 static void tlan_start(struct net_device *dev)
Signature · 1 line
2.32.0
#1 lore raw
This patch was applied to netdev/net.git (refs/heads/master):

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

Quoted 9 lines · On Fri, 9 Jul 2021 17:58:29 +0300 you wrote:

priv is netdev private data and it cannot be
used after free_netdev() call. Using priv after free_netdev() can cause UAF bug. Fix it by moving free_netdev() at the end of the function.

Fixes 1e0a8b13d355 ("tlan: cancel work at remove path")

[...]

Here is the summary with links:
- net: ti: fix UAF in tlan_remove_one

    https://git.kernel.org/netdev/net/c/0336f8ffece6

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