diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2020-03-03 15:01:46 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-03 15:45:49 -0800 |
commit | 8640f8dc6d657ebfb4e67c202ad32c5457858a13 (patch) | |
tree | 6f99a9e8436b274adc01c4cf79c6476b60af6c2f /net/dsa/dsa_priv.h | |
parent | f650bcd4ef5d6e2330593dbaaa814ffc945a9855 (diff) | |
download | lwn-8640f8dc6d657ebfb4e67c202ad32c5457858a13.tar.gz lwn-8640f8dc6d657ebfb4e67c202ad32c5457858a13.zip |
net: dsa: fix phylink_start()/phylink_stop() calls
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>
Diffstat (limited to 'net/dsa/dsa_priv.h')
-rw-r--r-- | net/dsa/dsa_priv.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index a7662e7a691d..760e6ea3178a 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h @@ -117,7 +117,9 @@ static inline struct net_device *dsa_master_find_slave(struct net_device *dev, /* port.c */ int dsa_port_set_state(struct dsa_port *dp, u8 state, struct switchdev_trans *trans); +int dsa_port_enable_rt(struct dsa_port *dp, struct phy_device *phy); int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy); +void dsa_port_disable_rt(struct dsa_port *dp); void dsa_port_disable(struct dsa_port *dp); int dsa_port_bridge_join(struct dsa_port *dp, struct net_device *br); void dsa_port_bridge_leave(struct dsa_port *dp, struct net_device *br); |