]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net: ti: fix UAF in tlan_remove_one
authorPavel Skripkin <paskripkin@gmail.com>
Fri, 9 Jul 2021 14:58:29 +0000 (17:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jul 2021 09:13:45 +0000 (11:13 +0200)
commit 0336f8ffece62f882ab3012820965a786a983f70 upstream.

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")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/ti/tlan.c

index 01f99e5df145601c3cf1795f7122de1fa2a9ec15..9f2129623d1899eaa4e49ef594dd349765b4bce7 100644 (file)
@@ -312,9 +312,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)