From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Chen-Yu Tsai <wens@kernel.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Russell King <linux@armlinux.org.uk>
Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev,
linux-stm32@st-md-mailman.stormreply.com,
linux-kernel@vger.kernel.org,
Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH net-next v4 0/5] net: stmmac: dwmac-sun8i: Fix the EPHY and MDIO mux ordering
Date: Fri, 20 Nov 2026 10:45:31 +0000 [thread overview]
Message-ID: <20261120-sun8i-emac-mux-uaf-v4-0-57eba8915f25@gmail.com> (raw)
Chen-Yu Tsai pointed out that the probe error path and remove() put the
EPHY clock and reset before sun8i_dwmac_exit() uses them (patch 1).
Sashiko and Maxime Chevallier pointed out that the EPHY lookup and the
mux registration run after register_netdev(), and Maxime suggested
registering the mux in the MDIO setup (patches 2, 4 and 5). Patch 2
replaces "Defer probe when the EPHY clock is not ready" [1]. Patch 3
balances runtime PM on the stmmac probe error path, which a mux failure
now takes.
Tested on QEMU orangepi-pc (H3, internal PHY) with KASAN; I have no H3,
H5 or V3s board. On net-next, a test-only mdio_mux_init() failure gives
a KASAN use-after-free in clk_disable() from sun8i_dwmac_exit(), and
unbinding with the link up oopses in phy_stop(). With the series both
are clean, a test device tree whose EPHY clock has no provider
(fw_devlink=permissive) defers before the netdev exists, and three
unbind/bind cycles with the link up pass. Without patch 3, after the
failed probe and a rebind the MAC stays runtime active with usage count
1; with it the MAC runtime-suspends (usage 0).
Developed with Claude (Anthropic); I reviewed it.
[1] https://lore.kernel.org/r/20261113-b4-sun8i-emac-ephy-defer-v1-1-12a8591702fe@gmail.com
---
Changes in v4:
- Put the EPHY clock and reset after stmmac_pltfr_remove() (Chen-Yu Tsai)
- Get the EPHY clock and reset before the MAC probe, defer on the clock (Sashiko, Maxime Chevallier)
- Balance runtime PM when the stmmac probe fails (new patch 3)
- Register the mux through new stmmac mdio_init()/mdio_exit() hooks (Maxime Chevallier)
- Now a series, new cover subject
- Link to v3: https://patch.msgid.link/20261115-sun8i-emac-mux-uaf-v3-1-c69d4189539d@gmail.com
Changes in v3:
- Drop the Fixes tag (Andrew Lunn)
- Shorter commit message
- Link to v2: https://patch.msgid.link/20261113-sun8i-emac-mux-uaf-v2-1-6203666b2687@gmail.com
Changes in v2:
- Target net-next instead of net, drop Cc: stable (Andrew Lunn)
- Shorter commit message
- Rebased onto net-next
- Link to v1: https://patch.msgid.link/20261112-sun8i-emac-mux-uaf-v1-1-308ae7e6fcf2@gmail.com
---
Arun Iyengar (5):
net: stmmac: dwmac-sun8i: Put the EPHY clock and reset after the MAC
net: stmmac: dwmac-sun8i: Get the EPHY clock and reset before the MAC probe
net: stmmac: Balance runtime PM when the probe fails
net: stmmac: Add MDIO init and exit platform hooks
net: stmmac: dwmac-sun8i: Register the MDIO mux in the MDIO setup
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 82 +++++++++--------------
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 11 +++
include/linux/stmmac.h | 2 +
4 files changed, 48 insertions(+), 49 deletions(-)
---
base-commit: 2208ab00f4f213ade91ab775e7f8c4dacdcc856e
change-id: 20261112-sun8i-emac-mux-uaf-1ba885219fee
Best regards,
--
Arun Iyengar <aiyengar1990@gmail.com>
next reply other threads:[~2026-11-20 10:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 10:45 Arun Iyengar via B4 Relay [this message]
2026-11-20 10:45 ` [PATCH net-next v4 1/5] net: stmmac: dwmac-sun8i: Put the EPHY clock and reset after the MAC Arun Iyengar via B4 Relay
2026-11-22 16:47 ` Maxime Chevallier
2026-11-20 10:45 ` [PATCH net-next v4 2/5] net: stmmac: dwmac-sun8i: Get the EPHY clock and reset before the MAC probe Arun Iyengar via B4 Relay
2026-11-22 16:51 ` Maxime Chevallier
2026-11-20 10:45 ` [PATCH net-next v4 3/5] net: stmmac: Balance runtime PM when the probe fails Arun Iyengar via B4 Relay
2026-11-22 17:03 ` Maxime Chevallier
2026-11-20 10:45 ` [PATCH net-next v4 4/5] net: stmmac: Add MDIO init and exit platform hooks Arun Iyengar via B4 Relay
2026-11-22 17:05 ` Maxime Chevallier
2026-11-22 17:35 ` Maxime Chevallier
2026-11-20 10:45 ` [PATCH net-next v4 5/5] net: stmmac: dwmac-sun8i: Register the MDIO mux in the MDIO setup Arun Iyengar via B4 Relay
2026-11-22 17:35 ` Maxime Chevallier
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=20261120-sun8i-emac-mux-uaf-v4-0-57eba8915f25@gmail.com \
--to=devnull+aiyengar1990.gmail.com@kernel.org \
--cc=aiyengar1990@gmail.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=jernej.skrabec@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux@armlinux.org.uk \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=samuel@sholland.org \
--cc=wens@kernel.org \
/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
all inboxes | Powered by JetHome®