public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Priit Laes <plaes@plaes.org>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Romain Perier <romain.perier@collabora.com>,
	Andrew Lunn <andrew@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chen-Yu Tsai <wens@csie.org>,
	Maxime Ripard <maxime.ripard@free-electrons.com>
Subject: Re: Crash due to fbca164776e438 - "net: stmmac: Use the right logging function in stmmac_mdio_register"
Date: Tue, 22 Aug 2017 19:20:57 +0000	[thread overview]
Message-ID: <20170822192057.GB6429@plaes.org> (raw)
In-Reply-To: <6d3c8253-1e31-761f-4b50-0bf087047753@gmail.com>

On Tue, Aug 22, 2017 at 12:01:32PM -0700, Florian Fainelli wrote:
> On 08/22/2017 11:47 AM, Priit Laes wrote:
> > Hi!
> > 
> > I'm running into following crash during boot on Cubietruck A20, with the patch
> > fbca164776e438
> > (net: stmmac: Use the right logging function in stmmac_mdio_register) applied:
> > 
> > [snip]
> > sun7i-dwmac 1c50000.ethernet: PTP uses main clock
> > sun7i-dwmac 1c50000.ethernet: no reset control found
> > sun7i-dwmac 1c50000.ethernet: no regulator found
> > sun7i-dwmac 1c50000.ethernet: Ring mode enabled
> > sun7i-dwmac 1c50000.ethernet: DMA HW capability register supported
> > sun7i-dwmac 1c50000.ethernet: Normal descriptors
> > libphy: stmmac: probed
> > Unable to handle kernel NULL pointer dereference at virtual address 00000048
> 
> Yes indeed:
> 
> (gdb) p/x (int)&((struct phy_driver *)0)->name
> $2 = 0x48
> 
> The following should fix it:
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 9493fb369682..810f6fd2f639 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -877,15 +877,17 @@ EXPORT_SYMBOL(phy_attached_info);
>  #define ATTACHED_FMT "attached PHY driver [%s] (mii_bus:phy_addr=%s,
> irq=%d)"
>  void phy_attached_print(struct phy_device *phydev, const char *fmt, ...)
>  {
> +       const char *drv_name = phydev->drv ? phydev->drv->name : "unbound";
> +
>         if (!fmt) {
>                 dev_info(&phydev->mdio.dev, ATTACHED_FMT "\n",
> -                        phydev->drv->name, phydev_name(phydev),
> +                        drv_name, phydev_name(phydev),
>                          phydev->irq);
>         } else {
>                 va_list ap;
> 
>                 dev_info(&phydev->mdio.dev, ATTACHED_FMT,
> -                        phydev->drv->name, phydev_name(phydev),
> +                        drv_name, phydev_name(phydev),
>                          phydev->irq);
> 
>                 va_start(ap, fmt);
> 

Thanks, patch works.

Tested-By: Priit Laes <plaes@plaes.org>

With reverted patch:

sun7i-dwmac 1c50000.ethernet (unnamed net_device) (uninitialized): PHY ID 001cc915 at 0 IRQ POLL (stmmac-0:00) active
sun7i-dwmac 1c50000.ethernet (unnamed net_device) (uninitialized): PHY ID 001cc915 at 1 IRQ POLL (stmmac-0:01)

With changes by Florian:

mdio_bus stmmac-0:00: attached PHY driver [unbound] (mii_bus:phy_addr=stmmac-0:00, irq=-1)
mdio_bus stmmac-0:01: attached PHY driver [unbound] (mii_bus:phy_addr=stmmac-0:01, irq=-1)


Päikest,
Priit :)

      reply	other threads:[~2017-08-22 19:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 18:47 Crash due to fbca164776e438 - "net: stmmac: Use the right logging function in stmmac_mdio_register" Priit Laes
2017-08-22 19:01 ` Florian Fainelli
2017-08-22 19:20   ` Priit Laes [this message]

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=20170822192057.GB6429@plaes.org \
    --to=plaes@plaes.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=netdev@vger.kernel.org \
    --cc=romain.perier@collabora.com \
    --cc=wens@csie.org \
    /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