Commit e925e0cd authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Jakub Kicinski

ethernet: ucc_geth: fix use-after-free in ucc_geth_remove()

ugeth is the netdiv_priv() part of the netdevice. Accessing the memory
pointed to by ugeth (such as done by ucc_geth_memclean() and the two
of_node_puts) after free_netdev() is thus use-after-free.

Fixes: 80a9fad8 ("ucc_geth: fix module removal")
Signed-off-by: default avatarRasmus Villemoes <rasmus.villemoes@prevas.dk>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 887078de
...@@ -3935,12 +3935,12 @@ static int ucc_geth_remove(struct platform_device* ofdev) ...@@ -3935,12 +3935,12 @@ static int ucc_geth_remove(struct platform_device* ofdev)
struct device_node *np = ofdev->dev.of_node; struct device_node *np = ofdev->dev.of_node;
unregister_netdev(dev); unregister_netdev(dev);
free_netdev(dev);
ucc_geth_memclean(ugeth); ucc_geth_memclean(ugeth);
if (of_phy_is_fixed_link(np)) if (of_phy_is_fixed_link(np))
of_phy_deregister_fixed_link(np); of_phy_deregister_fixed_link(np);
of_node_put(ugeth->ug_info->tbi_node); of_node_put(ugeth->ug_info->tbi_node);
of_node_put(ugeth->ug_info->phy_node); of_node_put(ugeth->ug_info->phy_node);
free_netdev(dev);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment