This is a note to let you know that I've just added the patch titled net: qcom/emac: fix UAF in emac_remove to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-qcom-emac-fix-uaf-in-emac_remove.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From ad297cd2db8953e2202970e9504cab247b6c7cb4 Mon Sep 17 00:00:00 2001 From: Pavel Skripkin <paskripkin@xxxxxxxxx> Date: Fri, 9 Jul 2021 17:24:18 +0300 Subject: net: qcom/emac: fix UAF in emac_remove From: Pavel Skripkin <paskripkin@xxxxxxxxx> commit ad297cd2db8953e2202970e9504cab247b6c7cb4 upstream. 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@xxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/ethernet/qualcomm/emac/emac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/qualcomm/emac/emac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac.c @@ -746,12 +746,13 @@ static int emac_remove(struct platform_d if (!has_acpi_companion(&pdev->dev)) 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; } Patches currently in stable-queue which might be from paskripkin@xxxxxxxxx are queue-4.9/net-ti-fix-uaf-in-tlan_remove_one.patch queue-4.9/net-qcom-emac-fix-uaf-in-emac_remove.patch queue-4.9/net-moxa-fix-uaf-in-moxart_mac_probe.patch