net: dsa: fix phylink_start()/phylink_stop() calls
authorRussell King <rmk+kernel@armlinux.org.uk>
Tue, 3 Mar 2020 15:01:46 +0000 (15:01 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Mar 2020 06:17:39 +0000 (07:17 +0100)
commit9dd6cb14dd010ce6f953085978864d3fbc7fd0bd
tree7629f6692b0dea31bb2badfffc361e1338b13d31
parent7b5db04f24a2321c5846d0d05643d218a4322582
net: dsa: fix phylink_start()/phylink_stop() calls

[ Upstream commit 8640f8dc6d657ebfb4e67c202ad32c5457858a13 ]

Place phylink_start()/phylink_stop() inside dsa_port_enable() and
dsa_port_disable(), which ensures that we call phylink_stop() before
tearing down phylink - which is a documented requirement.  Failure
to do so can cause use-after-free bugs.

Fixes: 0e27921816ad ("net: dsa: Use PHYLINK for the CPU/DSA ports")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/dsa/dsa_priv.h
net/dsa/port.c
net/dsa/slave.c