mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Crispin <john@phrozen.org>
To: Andrew Lunn <andrew@lunn.ch>
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:54:30 +0200	[thread overview]
Message-ID: <a310cfb9-8000-3906-242e-501900d5c8a0@phrozen.org> (raw)
In-Reply-To: <20161018122909.GR26778@lunn.ch>



On 18/10/2016 14:29, Andrew Lunn wrote:
> 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
> 

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

>>
>> 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:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18 12:12 John Crispin
2016-10-18 12:29 ` Andrew Lunn
2016-10-18 12:54   ` John Crispin [this message]
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=a310cfb9-8000-3906-242e-501900d5c8a0@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

all inboxes | Powered by JetHome®