]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: dsa: Fix network device registration order
authorFlorian Fainelli <f.fainelli@gmail.com>
Mon, 25 Sep 2017 22:55:53 +0000 (15:55 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Oct 2017 09:56:05 +0000 (11:56 +0200)
commit0265e1449bc0765103eec176232d2bbc070a991a
tree12ca67bf336a9a6606c8f948da79b23289dc32ba
parent87cd7f3356a17c49808a8a0ba344b9f2dbe30793
net: dsa: Fix network device registration order

[ 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.

Fixes: 0071f56e46da ("dsa: Register netdev before phy")
Fixes: 91da11f870f0 ("net: Distributed Switch Architecture protocol support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/dsa/slave.c