net: dsa: properly disconnect the slave PHYs
Subsystems (3)
PATCH 1/1 net: dsa: properly disconnect the slave PHYs
The shutdown code only stopped the PHYs but does not diconnect them properly. This could lead to null pointer deref related kernel oopses during reboot. Fix this by calling phy_disconnect() after the PHYs are stopped.
--- net/dsa/slave.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/dsa/slave.c +3 -1
@@ -154,8 +154,10 @@ static int dsa_slave_close(struct net_device *dev)struct net_device *master = p->parent->dst->master_netdev;struct dsa_switch *ds = p->parent; -if (p->phy) +if (p->phy) {phy_stop (p->phy); +phy_disconnect (p->phy); + }dev_mc_unsync (master, dev);dev_uc_unsync (master, dev);
Signature · 1 line
1.7.10.4
Andrew Lunn
maintainerQuoted 4 lines · John Crispin
The shutdown code only stopped the PHYs but does not diconnect them properly. This could lead to null pointer deref related kernel oopses during reboot. Fix this by calling
phy_disconnect()after the PHYs are stopped.
Humm, i don't follow this.
The phy is disconnected in dsa_slave_destroy(). Why is that not sufficient?
Also, after calling dsa_slave_close(), dsa_slave_open() can be called. But with your change, the phy has gone, so we are going to have trouble.
Andrew
Quoted 25 lines
Signed-off-by John Crispin <[email protected]>--- net/dsa/slave.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)net/dsa/slave.c +3
-1@@ -154,8 +154,10 @@ static int dsa_slave_close(struct net_device *dev)struct net_device *master = p->parent->dst->master_netdev;struct dsa_switch *ds = p->parent; -if (p->phy) +if (p->phy) {phy_stop (p->phy); +phy_disconnect (p->phy); + }dev_mc_unsync (master, dev);dev_uc_unsync (master, dev);Signature · 1 line
1.7.10.4
Quoted 8 lines · Andrew Lunn
Quoted 4 lines · John Crispin
The shutdown code only stopped the PHYs but does not diconnect them properly. This could lead to null pointer deref related kernel oopses during reboot. Fix this by calling
phy_disconnect()after the PHYs are stopped.Humm, i don't follow this.
Quoted 9 lines
The phy is disconnected in
dsa_slave_destroy(). Why is that not sufficient?Also, after calling
dsa_slave_close(),dsa_slave_open()can be called. But with your change, the phy has gone, so we are going to have trouble.Andrew
Hi Andrew
i am testing on v4.4 which did not have a phy_disconnect() call. this seems to have been fixed by cda5c15b so please ignore this patch
John
Quoted 25 lines
Quoted 25 lines
Signed-off-by John Crispin <[email protected]>--- net/dsa/slave.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)net/dsa/slave.c +3
-1@@ -154,8 +154,10 @@ static int dsa_slave_close(struct net_device *dev)struct net_device *master = p->parent->dst->master_netdev;struct dsa_switch *ds = p->parent; -if (p->phy) +if (p->phy) {phy_stop (p->phy); +phy_disconnect (p->phy); + }dev_mc_unsync (master, dev);dev_uc_unsync (master, dev);Signature · 1 line
1.7.10.4
Andrew Lunn
maintainerQuoted 4 lines
Hi Andrew
i am testing on v4.4 which did not have a
phy_disconnect()call. this seems to have been fixed bycda5c15bso please ignore this patch
Hi John
All patches must be against net-next, or net if it is a fix. Anything else is wrong....
Andrew
Quoted 5 lines · Andrew Lunn
Quoted 4 lines
Hi Andrew
i am testing on v4.4 which did not have a
phy_disconnect()call. this seems to have been fixed bycda5c15bso please ignore this patch
Quoted 7 lines
Hi John
All patches must be against net-next, or net if it is a fix. Anything else is wrong....
Andrew
Hi Andrew,
i know. i was testing on v4.4 and then rebased the patch against net-next without noticing that a similar patch had already been merged.
regardless, using the latest net-next tree, the oops is gone without adding any patches.
John