[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131014183906.GA4260@blackmetal.musicnaut.iki.fi>
Date: Mon, 14 Oct 2013 21:39:06 +0300
From: Aaro Koskinen <aaro.koskinen@....fi>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Greg KH <gregkh@...uxfoundation.org>, support@...iumnetworks.com,
netdev@...r.kernel.org, driverdev-devel@...uxdriverproject.org,
Sebastian Pöhn <sebastian.poehn@...il.com>,
David Daney <david.daney@...ium.com>
Subject: Re: [PATCH] staging: octeon-ethernet: trivial: Avoid OOPS if phydev
is not set
Hi,
On Mon, Oct 14, 2013 at 01:10:51PM +0300, Dan Carpenter wrote:
> On Sun, Oct 13, 2013 at 02:28:10PM -0700, Greg KH wrote:
> > On Sun, Oct 13, 2013 at 08:59:54PM +0200, Sebastian Pöhn wrote:
> > > A zero pointer deref on priv->phydev->link was causing oops on our systems.
> > > Might be related to improper configuration but we should fail gracefully here ;-)
> > >
> > > Signed-off-by: Sebastian Poehn <sebastian.poehn@...glemail.com>
> > >
> > > ---
> > >
> > > diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
> > > index 83b1030..bc8c503 100644
> > > --- a/drivers/staging/octeon/ethernet-mdio.c
> > > +++ b/drivers/staging/octeon/ethernet-mdio.c
> > > @@ -121,6 +121,9 @@ static void cvm_oct_adjust_link(struct net_device *dev)
> > > struct octeon_ethernet *priv = netdev_priv(dev);
> > > cvmx_helper_link_info_t link_info;
> > >
> > > + if(!priv->phydev)
> > > + return ;
> >
> > Please always run your patches through the scripts/checkpatch.pl tool so
> > that maintainers don't have to point out the obvious coding syle errors
> > by hand each time :)
>
> Also it's whitespace damaged and doesn't apply.
>
> >
> > Care to try again?
> >
> > Also, how was phydev NULL? What was causing that?
>
> To me it looks like phydev is always NULL.
It's initialized in cvm_oct_phy_setup_device():
priv->phydev = of_phy_connect(dev, phy_node, cvm_oct_adjust_link, 0,
PHY_INTERFACE_MODE_GMII);
So maybe there is a chance that cvm_oct_adjust_link() callback gets called
already before the function returns? Getting a copy of the original OOPS
report/crash dump could help to confirm this.
A.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists