[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZWNp4W2wnLGyT87C@shell.armlinux.org.uk>
Date: Sun, 26 Nov 2023 15:53:05 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Claudiu Beznea <claudiu.beznea@...on.dev>
Cc: nicolas.ferre@...rochip.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
andrew@...n.ch, hkallweit1@...il.com, jgarzik@...ox.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] net: phy: Check phydev->drv before dereferencing it
On Sun, Nov 26, 2023 at 04:10:45PM +0200, Claudiu Beznea wrote:
> The macb driver calls mdiobus_unregister() and mdiobus_free() in its remove
> function before calling unregister_netdev(). unregister_netdev() calls the
> driver-specific struct net_device_ops::ndo_stop function (macb_close()),
> and macb_close() calls phylink_disconnect_phy(). This, in turn, will call:
>
> phy_disconnect() ->
> phy_free_interrupt() ->
> phy_disable_interrupts() ->
> phy_config_interrupt()
>
> which dereference phydev->drv, which was already freed by:
> mdiobus_unregister() ->
> phy_mdio_device_remove() ->
> device_del() ->
> bus_remove_device() ->
> device_release_driver_internal() ->
> phy_remove()
>
> from macb_close().
>
> Although the sequence in the macb driver is not correct, check phydev->drv
> before dereferencing it in phy_config_interrupt() to avoid scenarios
> like the one described.
I don't know why I've ended up with two copies of this series, but as
said in the other posting of this patch (where details of why can be
found)... NAK.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists