net: phy: Check against net_device being NULL
authorIoana Ciornei <ioana.ciornei@nxp.com>
Tue, 28 May 2019 17:38:09 +0000 (20:38 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Aug 2019 07:33:17 +0000 (09:33 +0200)
commit6e6872b8ce53905e8d2a9dcfe05faa4fcb10c94b
tree377b30052efa6dc87288f8aa98dec0f2a05a9fbc
parent209085ee2786319f3c78e7371ea842ffa474b5fb
net: phy: Check against net_device being NULL

[ Upstream commit 82c76aca81187b3d28a6fb3062f6916450ce955e ]

In general, we don't want MAC drivers calling phy_attach_direct with the
net_device being NULL. Add checks against this in all the functions
calling it: phy_attach() and phy_connect_direct().

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/phy/phy_device.c