Patch "net: dsa: Fix network device registration order" has been added to the 4.9-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
net: dsa: Fix network device registration order
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
net-dsa-fix-network-device-registration-order.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Tue Oct 10 16:09:22 CEST 2017
From: Florian Fainelli <[email protected]>
Date: Mon, 25 Sep 2017 15:55:53 -0700
Subject: net: dsa: Fix network device registration order
From: Florian Fainelli <[email protected]>
[ Upstream commit e804441cfe0b60f6c430901946a69c01eac09df1 ]
We cannot be registering the network device first, then setting its carrier off and finally connecting it to a PHY, doing that leaves a window during which the carrier is at best inconsistent, and at worse the device is not usable without a down/up sequence since the network device is visible to user space with possibly no PHY device attached.
Re-order steps so that they make logical sense. This fixes some devices where the port was not usable after e.g: an unbind then bind of the driver.
--- net/dsa/slave.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
net/dsa/slave.c +17 -11
@@ -1269,26 +1269,32 @@ int dsa_slave_create(struct dsa_switch * p->old_duplex =-1 ; ds->ports[port].netdev = slave_dev; - ret =register_netdev (slave_dev); -if (ret) { -netdev_err (master,"error %d registering interface %s\n" , - ret, slave_dev->name); - ds->ports[port].netdev =NULL ; -free_netdev (slave_dev); -return ret; - }netif_carrier_off (slave_dev); ret =dsa_slave_phy_setup (p, slave_dev);if (ret) {netdev_err (master,"error %d setting up slave phy\n" , ret); -unregister_netdev (slave_dev); -free_netdev (slave_dev); -return ret; + goto out_free; + } + + ret =register_netdev (slave_dev); +if (ret) { +netdev_err (master,"error %d registering interface %s\n" , + ret, slave_dev->name); + goto out_phy; }return 0 ; + +out_phy: +phy_disconnect (p->phy); +if (of_phy_is_fixed_link (ds->ports[port].dn)) +of_phy_deregister_fixed_link (ds->ports[port].dn); +out_free: +free_netdev (slave_dev); + ds->ports[port].netdev =NULL ; +return ret; }void dsa_slave_destroy (struct net_device *slave_dev)
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/net-dsa-fix-network-device-registration-order.patch