Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3cda77eb authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Greg Kroah-Hartman
Browse files

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



[ Upstream commit e925e0cd2a705aaacb0b907bb3691fcac3a973a4 ]

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>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 215f63fc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3934,10 +3934,10 @@ static int ucc_geth_remove(struct platform_device* ofdev)
	struct ucc_geth_private *ugeth = netdev_priv(dev);

	unregister_netdev(dev);
	free_netdev(dev);
	ucc_geth_memclean(ugeth);
	of_node_put(ugeth->ug_info->tbi_node);
	of_node_put(ugeth->ug_info->phy_node);
	free_netdev(dev);

	return 0;
}