All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergej Bauer <sbauer@blackbox.su>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Markus Elfring <Markus.Elfring@web.de>,
	netdev@vger.kernel.org, UNGLinuxDriver@microchip.com,
	linux-kernel@vger.kernel.org,
	Bryan Whitehead <bryan.whitehead@microchip.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH v2] lan743x: Fix for potential null pointer dereference
Date: Sun, 01 Nov 2020 23:54:04 +0300	[thread overview]
Message-ID: <2534292.OMWdIsrgY9@metabook> (raw)
In-Reply-To: <20201101203820.GD1109407@lunn.ch>

On Sunday, November 1, 2020 11:38:20 PM MSK Andrew Lunn wrote:
> On Sun, Nov 01, 2020 at 10:54:38PM +0300, Sergej Bauer wrote:
> > > > Signed-off-by: Sergej Bauer <sbauer@blackbox.su>
> > > 
> > > * I miss a change description here.
> > 
> > The reason for the fix is when the device is down netdev->phydev will be
> > NULL and there is no checking for this situation. So 'ethtool ethN' leads
> > to kernel panic.
> > 
> > > > @@ -809,9 +812,12 @@ static int lan743x_ethtool_set_wol(struct
> > > > net_device
> > > > *netdev,>
> > > > 
> > > >  	device_set_wakeup_enable(&adapter->pdev->dev, (bool)wol->wolopts);
> > > > 
> > > > -	phy_ethtool_set_wol(netdev->phydev, wol);
> > > > +	if (netdev->phydev)
> > > > +		ret = phy_ethtool_set_wol(netdev->phydev, wol);
> > > > +	else
> > > > +		ret = -EIO;
> 
> -ENETDOWN would be better, it gives a hit that WoL can be configured
> when the interface is configured up.
> 
>  Andrew

Ok, thank you, Andrew! I was doubted in the correctness of returning -EIO.

                Regards,
                        Sergej.




      reply	other threads:[~2020-11-01 20:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29  0:28 [PATCH] fix for potential NULL pointer dereference with bare lan743x Sergej Bauer
2020-10-31  0:03 ` Jakub Kicinski
2020-10-31 14:36   ` [PATCH v2] " Sergej Bauer
     [not found]     ` <dabea6fc-2f2d-7864-721b-3c950265f764@web.de>
2020-11-01 19:54       ` [PATCH v2] lan743x: Fix for potential null pointer dereference Sergej Bauer
2020-11-01 20:38         ` Andrew Lunn
2020-11-01 20:54           ` Sergej Bauer [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=2534292.OMWdIsrgY9@metabook \
    --to=sbauer@blackbox.su \
    --cc=Markus.Elfring@web.de \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=bryan.whitehead@microchip.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.