Messages in this thread | | | Date | Tue, 18 Sep 2018 00:13:46 +0100 | From | Russell King - ARM Linux <> | Subject | Re: [PATCH net] net: phy: sfp: Prevent NULL deference of socket_ops |
| |
On Mon, Sep 17, 2018 at 10:30:52AM -0700, Florian Fainelli wrote: > On 09/15/2018 12:32 AM, Russell King - ARM Linux wrote: > > On Fri, Sep 14, 2018 at 04:01:31PM -0700, Florian Fainelli wrote: > >> In case we have specified a SFP and an I2C phandle in the Device Tree, > >> but we somehow failed to look up the I2C adapter (e.g: the driver is not > >> enabled), we will leave dangling socket_ops, and the sfp_bus will still > >> have been registered. We can then observe NULL pointer dereferences > >> while doing ethtool -m: > >> > >> [ 20.218613] Unable to handle kernel NULL pointer dereference at virtual address 00000008 > >> [ 20.226977] pgd = (ptrval) > >> [ 20.229785] [00000008] *pgd=7c400831, *pte=00000000, *ppte=00000000 > >> [ 20.236274] Internal error: Oops: 17 [#1] SMP ARM > >> [ 20.241122] Modules linked in: > >> [ 20.244278] CPU: 0 PID: 1480 Comm: ethtool Not tainted 4.19.0-rc3 #138 > >> [ 20.251013] Hardware name: Broadcom Northstar Plus SoC > >> [ 20.256316] PC is at sfp_get_module_info+0x8/0x10 > >> [ 20.261172] LR is at dev_ethtool+0x218c/0x2afc > >> > >> Specifically guard against that. > > > > The other alternative to this would be to only set ndev->sfp_bus when > > the bus moves to registered state, which would probably be a saner > > alternative than to add an additional layer of tests. IOW: > > Indeed, your patch works for me: > > Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Thanks, I'll re-send it properly for davem tomorrow.
-- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up According to speedtest.net: 13Mbps down 490kbps up
| |