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]
Date:   Thu, 30 Sep 2021 16:58:53 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc:     Heiner Kallweit <hkallweit1@...il.com>,
        "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH RFT net-next] net: mdio: ensure the type of mdio devices
 match mdio drivers

On Thu, Sep 30, 2021 at 03:54:44PM +0100, Russell King (Oracle) wrote:
> On the MDIO bus, we have PHYLIB devices and drivers, and we have non-
> PHYLIB devices and drivers. PHYLIB devices are MDIO devices that are
> wrapped with a struct phy_device.
> 
> Trying to bind a MDIO device with a PHYLIB driver results in out-of-
> bounds accesses as we attempt to access struct phy_device members. So,
> let's prevent this by ensuring that the type of the MDIO device
> (indicated by the MDIO_DEVICE_FLAG_PHY flag) matches the type of the
> MDIO driver (indicated by the MDIO_DEVICE_IS_PHY flag.)
> 
> Link: https://lore.kernel.org/r/2b1dc053-8c9a-e3e4-b450-eecdfca3fe16@gmail.com
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> ---
> Tested locally in SolidRun Clearfog, DSA switch and PHY get probed
> correctly. Further testing welcomed.
> 
>  drivers/net/phy/mdio_bus.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 53f034fc2ef7..779e49715e91 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -939,6 +939,12 @@ EXPORT_SYMBOL_GPL(mdiobus_modify);
>  static int mdio_bus_match(struct device *dev, struct device_driver *drv)
>  {
>  	struct mdio_device *mdio = to_mdio_device(dev);
> +	struct mdio_driver *mdiodrv = to_mdio_driver(drv);

DaveM would request these two lines are swapped for reverse Christmas tree.

      Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ