From: sashiko-bot@kernel.org
To: "Christian Marangi" <ansuelsmth@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v10 02/11] net: phylink: introduce internal phylink PCS handling
Date: Fri, 31 Jul 2026 12:48:14 +0000 [thread overview]
Message-ID: <20260731124814.8E5561F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260730102444.1967900-3-ansuelsmth@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] phylink_validate_mac_and_pcs() incorrectly validates unsupported interfaces when a required PCS is missing.
--
--- Patch [2]: [PATCH net-next v10 02/11] net: phylink: introduce internal phylink PCS handling ---
commit 523b36754a7978492b9869c650925bee50a978c5
Author: Christian Marangi <ansuelsmth@gmail.com>
net: phylink: introduce internal phylink PCS handling
Introduce internal handling of PCS for phylink. This is an alternative
way to .mac_select_pcs that moves the selection logic of the PCS entirely
to phylink with the usage of the supported_interface value in the PCS
struct.
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 3464e3ec56997..a5e2d342a92e1 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
[ ... ]
> @@ -530,9 +552,24 @@ static int phylink_validate_mac_and_pcs(struct phylink *pl,
> pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface);
> if (IS_ERR(pcs))
> return PTR_ERR(pcs);
> +
> + pcs_found = !!pcs;
> + /*
> + * Find a PCS in available PCS list for the requested interface.
> + *
> + * Skip searching if the MAC doesn't require a dedicated PCS for
> + * the requested interface.
> + */
> + } else if (test_bit(state->interface, pl->config->pcs_interfaces)) {
> + list_for_each_entry(pcs, &pl->pcs_list, list) {
> + if (!phylink_validate_pcs_interface(pcs, state->interface)) {
> + pcs_found = true;
> + break;
> + }
> + }
> }
>
> - if (pcs) {
> + if (pcs_found) {
[Severity: Medium]
If the interface requires a dedicated PCS (the test_bit check is true)
but no matching PCS is found in the list, pcs_found will remain false.
Does this inadvertently skip PCS validation and fall through to MAC
validation?
It appears this allows phylink to incorrectly report that an interface
mode is supported even if the mandatory PCS is missing. Any subsequent
attempt to configure the link with this mode will then fail at runtime
in phylink_major_config(), which correctly aborts if the required PCS
isn't found.
Should phylink_validate_mac_and_pcs() return -EINVAL when a required
PCS is missing?
> /* The PCS, if present, must be setup before phylink_create()
> * has been called. If the ops is not initialised, print an
> * error and backtrace rather than oopsing the kernel.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260730102444.1967900-1-ansuelsmth@gmail.com?part=2
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 [this message]
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
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=20260731124814.8E5561F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox