From: sashiko-bot@kernel.org
To: "Coia Prant" <coiaprant@gmail.com>
Cc: neil.armstrong@linaro.org, olteanv@gmail.com, vkoul@kernel.org,
wsa+renesas@sang-engineering.com, robh@kernel.org,
linux-phy@lists.infradead.org, conor+dt@kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v7 07/11] net: pcs: xpcs: add Rockchip RK3568 platform glue driver
Date: Fri, 18 Sep 2026 20:48:46 +0000 [thread overview]
Message-ID: <20260918204847.2B6441F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260917204624.2427486-8-coiaprant@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] net: pcs: use-after-free in xpcs_rk_create() during concurrent supplier unbind
- [Low] kconfig: unmet dependency warning due to PM_GENERIC_DOMAINS select without PM
--
commit 7e2d67535ce6f3173f2984680b0a77b61caaf964
Author: Coia Prant <coiaprant@gmail.com>
net: pcs: xpcs: add Rockchip RK3568 platform glue driver
This commit adds a platform glue driver for the Synopsys DesignWare XPCS
on Rockchip RK3568 SoCs. It implements a virtual MDIO bus to translate
MDIO operations into APB3 memory-mapped register accesses.
Link: https://dl.radxa.com/rock3/docs/hw/datasheet/Rockchip%20RK3568%20TRM%20Part1%20V1.1-20210301.pdf (Page 59, CRU_CLKSEL_CON29)
Link: https://dl.radxa.com/rock3/docs/hw/datasheet/Rockchip%20RK3568%20TRM%20Part2%20V1.1-20210301.pdf (Page 2078)
> diff --git a/drivers/net/pcs/Kconfig b/drivers/net/pcs/Kconfig
> --- a/drivers/net/pcs/Kconfig
> +++ b/drivers/net/pcs/Kconfig
[ ... ]
> +config PCS_XPCS_ROCKCHIP
> + tristate "Rockchip XPCS controller support"
> + default ARCH_ROCKCHIP
> + depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST)
> + select GENERIC_PHY
> + select PM_GENERIC_DOMAINS
[Severity: Low]
Will this cause a Kconfig unmet direct dependency warning during compilation
when PM is not enabled?
Because PCS_XPCS_ROCKCHIP has a COMPILE_TEST fallback in its depends on
list, it can be enabled on architectures without CONFIG_PM. Forcefully
selecting PM_GENERIC_DOMAINS (which depends on PM) without inheriting
that dependency could lead to a configuration mismatch.
Could this Kconfig entry add a dependency on PM, or only conditionally
select PM_GENERIC_DOMAINS?
> diff --git a/drivers/net/pcs/pcs-xpcs-rk.c b/drivers/net/pcs/pcs-xpcs-rk.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/net/pcs/pcs-xpcs-rk.c
[ ... ]
> + /*
> + * Pin the supplier before reading its drvdata: device_link_add()
> + * refuses to create a managed link while the supplier is being
> + * unbound, so if it succeeds the drvdata cannot be freed under us.
> + * The link is released automatically when the consumer device is
> + * destroyed (DL_FLAG_AUTOREMOVE_CONSUMER), which covers all probe
> + * failure paths, so no explicit device_link_remove() is needed.
> + */
> + if (!device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_CONSUMER)) {
> + put_device(&pdev->dev);
> + return ERR_PTR(-EPROBE_DEFER);
> + }
> +
> + pxpcs = platform_get_drvdata(pdev);
> + if (!pxpcs || !pxpcs->bus) {
[Severity: High]
Is this sequence in xpcs_rk_create() safe against a concurrent supplier
unbind?
The comment assumes device_link_add() returns NULL if the supplier is
unbinding, but it actually succeeds and creates a link with a state like
DL_STATE_SUPPLIER_UNBIND or DL_STATE_DORMANT.
If userspace concurrently unbinds the XPCS supplier device while this
consumer MAC driver is probing, reading the drvdata via
platform_get_drvdata(pdev) might yield a pointer to devres memory that
has already been freed by the supplier's remove path.
Should this code acquire the device lock on the supplier, or otherwise
verify the device is fully bound before dereferencing its drvdata?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260917204624.2427486-1-coiaprant@gmail.com?part=7
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-09-18 20:48 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 20:46 [PATCH net-next v7 00/11] net: pcs: add basic support for RK3568 XPCS Coia Prant
2026-09-17 20:46 ` [PATCH net-next v7 01/11] net: stmmac: move XPCS lifetime management to platform drivers Coia Prant
2026-09-21 23:43 ` netdev-bot+sashiko
2026-09-17 20:46 ` [PATCH net-next v7 02/11] dt-bindings: phy: rockchip: naneng-combphy: add rockchip,sgmii-mac-sel property Coia Prant
2026-09-21 23:43 ` netdev-bot+sashiko
2026-09-17 20:46 ` [PATCH net-next v7 03/11] phy: rockchip: naneng-combphy: add SGMII MAC selection for RK3568 Coia Prant
2026-09-21 23:43 ` netdev-bot+sashiko
2026-09-17 20:46 ` [PATCH net-next v7 04/11] dt-bindings: net: pcs: add rockchip,rk3568-xpcs support Coia Prant
2026-09-21 23:43 ` netdev-bot+sashiko
2026-09-17 20:46 ` [PATCH net-next v7 05/11] arm64: dts: rockchip: rk3568: add XPCS and fixed-clock nodes Coia Prant
2026-09-18 20:48 ` sashiko-bot
2026-09-21 23:43 ` netdev-bot+sashiko
2026-09-17 20:46 ` [PATCH net-next v7 06/11] net: pcs: xpcs: add ANRESTART support for SGMII link recovery Coia Prant
2026-09-21 23:43 ` netdev-bot+sashiko
2026-09-17 20:46 ` [PATCH net-next v7 07/11] net: pcs: xpcs: add Rockchip RK3568 platform glue driver Coia Prant
2026-09-18 20:48 ` sashiko-bot [this message]
2026-09-19 12:30 ` Coia Prant
2026-09-21 23:43 ` netdev-bot+sashiko
2026-09-17 20:46 ` [PATCH net-next v7 08/11] dt-bindings: net: rockchip-dwmac: document pcs-handle Coia Prant
2026-09-21 23:43 ` netdev-bot+sashiko
2026-09-17 20:46 ` [PATCH net-next v7 09/11] net: stmmac: dwmac-rk: add SGMII support for RK3568 Coia Prant
2026-09-21 23:43 ` netdev-bot+sashiko
2026-09-17 20:46 ` [PATCH net-next v7 10/11] arm64: dts: rockchip: rk3568-photonicat: enable SGMII LAN port Coia Prant
2026-09-21 23:43 ` netdev-bot+sashiko
2026-09-17 20:46 ` [PATCH net-next v7 11/11] MAINTAINERS: add entry for Rockchip XPCS driver Coia Prant
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=20260918204847.2B6441F00898@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=coiaprant@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
--cc=wsa+renesas@sang-engineering.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