net: usb: lan78xx: Connect PHY before registering MAC
authorAndrew Lunn <andrew@lunn.ch>
Thu, 17 Oct 2019 19:29:26 +0000 (21:29 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Oct 2019 17:22:04 +0000 (10:22 -0700)
commit38b4fe320119859c11b1dc06f6b4987a16344fa1
tree4ae04c34ed6e6b86314e9aa25feda0c8eaa0bff0
parente381d2b4e25306140fdedfd802f0913b901a2d31
net: usb: lan78xx: Connect PHY before registering MAC

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>
drivers/net/usb/lan78xx.c