From: Andrew Lunn <andrew@lunn.ch>
To: Sergej Bauer <sbauer@blackbox.su>
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, 1 Nov 2020 21:38:20 +0100 [thread overview]
Message-ID: <20201101203820.GD1109407@lunn.ch> (raw)
In-Reply-To: <145853726.prPdODYtnq@metabook>
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
next prev parent reply other threads:[~2020-11-01 20:38 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 [this message]
2020-11-01 20:54 ` Sergej Bauer
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=20201101203820.GD1109407@lunn.ch \
--to=andrew@lunn.ch \
--cc=Markus.Elfring@web.de \
--cc=UNGLinuxDriver@microchip.com \
--cc=bryan.whitehead@microchip.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sbauer@blackbox.su \
/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