net: usb: lan78xx: Connect PHY before registering MAC
authorAndrew Lunn <andrew@lunn.ch>
Thu, 17 Oct 2019 19:29:26 +0000 (21:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Nov 2019 10:27:53 +0000 (11:27 +0100)
commit6b5bf3f37f726cf35e647aaec9f157d3685b291e
treef67df290d907de8ec05f2cb955730c09f90d6ba7
parent07c62fc7bf28de7521a579d0a86f3f9ec3ef0b26
net: usb: lan78xx: Connect PHY before registering MAC

[ Upstream commit 38b4fe320119859c11b1dc06f6b4987a16344fa1 ]

As soon as the netdev is registers, the kernel can start using the
interface. If the driver connects the MAC to the PHY after the netdev
is registered, there is a race condition where the interface can be
opened without having the PHY connected.

Change the order to close this race condition.

Fixes: 92571a1aae40 ("lan78xx: Connect phy early")
Reported-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/usb/lan78xx.c