From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: nicolas.ferre@microchip.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
andrew@lunn.ch, hkallweit1@gmail.com, jgarzik@pobox.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] net: phy: Check phydev->drv before dereferencing it
Date: Sun, 26 Nov 2023 15:53:05 +0000 [thread overview]
Message-ID: <ZWNp4W2wnLGyT87C@shell.armlinux.org.uk> (raw)
In-Reply-To: <20231126141046.3505343-2-claudiu.beznea@tuxon.dev>
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!
next prev parent reply other threads:[~2023-11-26 15:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-26 14:10 [PATCH 0/2] net: macb: Fixes for macb driver Claudiu Beznea
2023-11-26 14:10 ` [PATCH 1/2] net: phy: Check phydev->drv before dereferencing it Claudiu Beznea
2023-11-26 15:53 ` Russell King (Oracle) [this message]
2023-11-26 14:10 ` [PATCH 2/2] net: macb: Unregister nedev before MDIO bus in remove Claudiu Beznea
2023-11-26 15:51 ` Russell King (Oracle)
2023-11-26 17:13 ` Andrew Lunn
2023-11-26 17:49 ` Russell King (Oracle)
2023-11-27 6:11 ` claudiu beznea
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZWNp4W2wnLGyT87C@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=claudiu.beznea@tuxon.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=jgarzik@pobox.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).