From: sashiko-bot@kernel.org
To: "Christian Marangi" <ansuelsmth@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v10 06/11] net: Document PCS subsystem
Date: Fri, 31 Jul 2026 12:48:18 +0000 [thread overview]
Message-ID: <20260731124818.9991C1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260730102444.1967900-7-ansuelsmth@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Race condition between `phylink_release_pcs` and `phylink_create`/`phylink_destroy` leading to list corruption and use-after-free.
--
--- Patch [6]: [PATCH net-next v10 06/11] net: Document PCS subsystem ---
commit 71f5e420c5ee13d83f4218aff0877aa80d862ffc
Author: Christian Marangi <ansuelsmth@gmail.com>
net: Document PCS subsystem
This commit adds extensive documentation for the new PCS subsystem and its
fwnode implementation using a producer/consumer API. It also updates the
sfp-phylink migration guide.
> diff --git a/Documentation/networking/pcs.rst b/Documentation/networking/pcs.rst
> new file mode 100644
> index 0000000000000..e16d8b5bf6612
> --- /dev/null
> +++ b/Documentation/networking/pcs.rst
[ ... ]
> +You must call :c:func:`fwnode_pcs_del_provider` from your remove function and
> +release the PCS from any phylink instance under RTNL lock with
> +:c:func:`phylink_release_pcs`::
> +
> + fwnode_pcs_del_provider(dev_fwnode(&pdev->dev));
> +
> + rtnl_lock();
> +
> + for (i = 0; i < data->num_port; i++) {
> + struct pcs_port *port = &priv->ports[i];
> +
> + phylink_release_pcs(&port->pcs);
[Severity: High]
Does this documentation example encourage a teardown pattern that can cause a
use-after-free and list corruption?
If a PCS provider module is removed concurrently with a MAC driver probe (which
calls phylink_create()) or remove (which calls phylink_destroy()), and the PCS
driver calls phylink_release_pcs() as shown here, they can race.
For instance, phylink_release_pcs() accesses pcs->phylink and takes
pl->state_mutex. If phylink_destroy() runs concurrently, it could free pl
just before mutex_lock(), causing a use-after-free.
Also, phylink_create() iterates pl->pcs_list without holding pl->state_mutex.
A concurrent phylink_release_pcs() will modify the list, causing list
corruption. Similarly, phylink_destroy() modifies the list and clears
pcs->phylink without holding pl->state_mutex.
Because fw_devlink does not natively parse pcs-handle to enforce ordering,
the driver core does not prevent these modules from being unloaded
simultaneously.
Is there a safer teardown sequence that should be documented here instead?
> + }
> +
> + rtnl_unlock();
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260730102444.1967900-1-ansuelsmth@gmail.com?part=6
next prev parent reply other threads:[~2026-07-31 12:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 10:24 [PATCH net-next v10 00/11] net: pcs: Introduce support for fwnode PCS Christian Marangi
2026-07-30 10:24 ` [PATCH net-next v10 01/11] net: phylink: keep and use MAC supported_interfaces in phylink struct Christian Marangi
2026-07-30 10:24 ` [PATCH net-next v10 02/11] net: phylink: introduce internal phylink PCS handling Christian Marangi
2026-07-31 12:48 ` sashiko-bot
2026-07-30 10:24 ` [PATCH net-next v10 03/11] net: phylink: add phylink_release_pcs() to externally release a PCS Christian Marangi
2026-07-31 12:48 ` sashiko-bot
2026-07-30 10:24 ` [PATCH net-next v10 04/11] net: pcs: implement Firmware node support for PCS driver Christian Marangi
2026-07-31 12:48 ` sashiko-bot
2026-07-30 10:24 ` [PATCH net-next v10 05/11] net: phylink: support late PCS provider attach Christian Marangi
2026-07-31 12:48 ` sashiko-bot
2026-07-30 10:24 ` [PATCH net-next v10 06/11] net: Document PCS subsystem Christian Marangi
2026-07-31 12:48 ` sashiko-bot [this message]
2026-07-30 10:24 ` [PATCH net-next v10 07/11] MAINTAINERS: add myself as PCS subsystem maintainer Christian Marangi
2026-07-30 10:24 ` [PATCH net-next v10 08/11] net: phylink: add .pcs_link_down PCS OP Christian Marangi
2026-07-30 10:24 ` [PATCH net-next v10 09/11] dt-bindings: net: pcs: Document support for Airoha Ethernet PCS Christian Marangi
2026-07-30 10:24 ` [PATCH net-next v10 10/11] net: pcs: airoha: add PCS driver for Airoha AN7581 SoC Christian Marangi
2026-07-31 12:48 ` sashiko-bot
2026-07-30 10:24 ` [PATCH net-next v10 11/11] net: airoha: add phylink support Christian Marangi
2026-07-30 11:56 ` Lorenzo Bianconi
2026-07-31 12:48 ` sashiko-bot
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=20260731124818.9991C1F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ansuelsmth@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.