public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Crispin <john@phrozen.org>
To: Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@savoirfairelinux.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	John Crispin <john@phrozen.org>
Subject: [PATCH] net: dsa: properly disconnect the slave PHYs
Date: Tue, 18 Oct 2016 14:12:40 +0200	[thread overview]
Message-ID: <1476792760-60356-1-git-send-email-john@phrozen.org> (raw)

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.

Signed-off-by: John Crispin <john@phrozen.org>
---
 net/dsa/slave.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 68714a5..725d9f7 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -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);
-- 
1.7.10.4

             reply	other threads:[~2016-10-18 12:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18 12:12 John Crispin [this message]
2016-10-18 12:29 ` [PATCH] net: dsa: properly disconnect the slave PHYs Andrew Lunn
2016-10-18 12:54   ` John Crispin
2016-10-18 13:24     ` Andrew Lunn
2016-10-18 13:27       ` John Crispin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476792760-60356-1-git-send-email-john@phrozen.org \
    --to=john@phrozen.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox