lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YVWjEQzJisT0HgHB@shell.armlinux.org.uk>
Date:   Thu, 30 Sep 2021 12:44:17 +0100
From:   "Russell King (Oracle)" <linux@...linux.org.uk>
To:     Rafał Miłecki <zajec5@...il.com>
Cc:     Andrew Lunn <andrew@...n.ch>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Network Development <netdev@...r.kernel.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        BCM Kernel Feedback <bcm-kernel-feedback-list@...adcom.com>,
        Vivek Unune <npcomplete13@...il.com>
Subject: Re: Lockup in phy_probe() for MDIO device (Broadcom's switch)

On Thu, Sep 30, 2021 at 01:29:33PM +0200, Rafał Miłecki wrote:
> On 30.09.2021 12:40, Russell King (Oracle) wrote:
> > In phy_probe, can you add:
> > 
> > 	WARN_ON(!(phydev->mdio.flags & MDIO_DEVICE_FLAG_PHY));
> > 
> > just to make sure we have a real PHY device there please? Maybe also
> > print the value of the flags argument.
> > 
> > MDIO_DEVICE_FLAG_PHY is set by phy_create_device() before the mutex is
> > initialised, so if it is set, the lock should be initialised.
> > 
> > Maybe also print mdiodev->flags in mdio_device_register() as well, so
> > we can see what is being registered and the flags being used for that
> > device.
> > 
> > Could it be that openwrt is carrying a patch that is causing this
> > issue?
> 
> I don't think there is any OpenWrt patch affecting that.
> 
> MDIO_DEVICE_FLAG_PHY seems to be missing.

Right, so the mdio device being registered is a non-PHY MDIO device.
It doesn't have a struct phy_device around it - and so any access
outside of the mdio_device is an out-of-bounds access.

Consequently, phylib should not be matching this device. The only
remaining way I can see that this could happen is if a PHY driver has
an OF compatible, which phylib drivers should never have.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ