From: Andrew Lunn <andrew@lunn.ch>
To: John Crispin <john@phrozen.org>
Cc: Vivien Didelot <vivien.didelot@savoirfairelinux.com>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: dsa: properly disconnect the slave PHYs
Date: Tue, 18 Oct 2016 14:29:09 +0200 [thread overview]
Message-ID: <20161018122909.GR26778@lunn.ch> (raw)
In-Reply-To: <1476792760-60356-1-git-send-email-john@phrozen.org>
On Tue, Oct 18, 2016 at 02:12:40PM +0200, John Crispin wrote:
> 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
>
> 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
>
next prev parent reply other threads:[~2016-10-18 12:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-18 12:12 [PATCH] net: dsa: properly disconnect the slave PHYs John Crispin
2016-10-18 12:29 ` Andrew Lunn [this message]
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=20161018122909.GR26778@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=john@phrozen.org \
--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