[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2534292.OMWdIsrgY9@metabook>
Date: Sun, 01 Nov 2020 23:54:04 +0300
From: Sergej Bauer <sbauer@...ckbox.su>
To: Andrew Lunn <andrew@...n.ch>
Cc: Markus Elfring <Markus.Elfring@....de>, netdev@...r.kernel.org,
UNGLinuxDriver@...rochip.com, linux-kernel@...r.kernel.org,
Bryan Whitehead <bryan.whitehead@...rochip.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH v2] lan743x: Fix for potential null pointer dereference
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@...ckbox.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.
Powered by blists - more mailing lists