netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: hs@denx.de
Cc: netdev@vger.kernel.org, maowenan <maowenan@huawei.com>,
	andrew@lunn.ch, rmk+kernel@armlinux.org.uk, festevam@gmail.com,
	davem@davemloft.net, nikita.yoush@cogentembedded.com
Subject: Re: [net, v3, 1/3] net: phy: Fix PHY module checks and NULL deref in phy_attach_direct()
Date: Wed, 8 Feb 2017 23:13:51 -0800	[thread overview]
Message-ID: <8c63b88f-c7d3-dd53-e3a8-9d38bb5a154c@gmail.com> (raw)
In-Reply-To: <589C1309.5040302@denx.de>



On 02/08/2017 10:58 PM, Heiko Schocher wrote:
> Hello Florian,
> 
> Am 09.02.2017 um 01:13 schrieb Florian Fainelli:
>> The Generic PHY drivers gets assigned after we checked that the current
>> PHY driver is NULL, so we need to check a few things before we can
>> safely dereference d->driver. This would be causing a NULL deference to
>> occur when a system binds to the Generic PHY driver. Update
>> phy_attach_direct() to do the following:
>>
>> - grab the driver module reference after we have assigned the Generic
>>    PHY drivers accordingly
>>
>> - update the error path to clean up the module reference in case the
>>    Generic PHY probe function fails
>>
>> Fixes: cafe8df8b9bc ("net: phy: Fix lack of reference count on PHY
>> driver")
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>>   drivers/net/phy/phy_device.c | 16 +++++++++++++++-
>>   1 file changed, 15 insertions(+), 1 deletion(-)
> 
> just stumbled over this bug on an am335x based board, with an
> KSZ8081 attached, so there a "fixed-link" is used like:
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/am335x-baltos-ir3220.dts#n105
> 
> 
> With your patch it crashes also ...

The final version of the patch is here:

http://patchwork.ozlabs.org/patch/725923/

Do you mind giving it a try?
-- 
Florian

  reply	other threads:[~2017-02-09  7:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09  0:13 [PATCH net v3 0/3] net: phy: Fix PHY module checks and NULL deref in phy_attach_direct() Florian Fainelli
2017-02-09  0:13 ` [PATCH net v3 1/3] " Florian Fainelli
2017-02-09  0:15   ` Florian Fainelli
2017-02-09  6:58   ` [net, v3, " Heiko Schocher
2017-02-09  7:13     ` Florian Fainelli [this message]
2017-02-09  7:29       ` Heiko Schocher
2017-02-09  0:14 ` [PATCH net v3 2/3] net: phy: Check phydev->drv Florian Fainelli
2017-02-09  0:14 ` [PATCH net v3 3/3] net: phy: Fix PHY driver bind and unbind events Florian Fainelli

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=8c63b88f-c7d3-dd53-e3a8-9d38bb5a154c@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=festevam@gmail.com \
    --cc=hs@denx.de \
    --cc=maowenan@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikita.yoush@cogentembedded.com \
    --cc=rmk+kernel@armlinux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).