From: sashiko-bot@kernel.org
To: "Christian Marangi" <ansuelsmth@gmail.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v9 06/12] net: Document PCS subsystem
Date: Sat, 18 Jul 2026 09:01:17 +0000 [thread overview]
Message-ID: <20260718090117.AD06A1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260717065448.1498335-7-ansuelsmth@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] phylink_create() returns an invalid non-error pointer (or NULL) on invalid config->type.
--
--- Patch [6]: [PATCH net-next v9 06/12] net: Document PCS subsystem ---
commit 867ad4be39467be718a5df59cf2a9739b1c43531
Author: Christian Marangi <ansuelsmth@gmail.com>
net: phylink: introduce internal phylink PCS handling
This commit introduces internal handling of PCS for phylink, moving the
selection logic to phylink using the supported_interface value. It updates
phylink_create() to allocate and populate an array of PCS pointers from the
MAC, creating a linked list of available PCS devices. The changes also include
new validation to ensure a selected PCS supports the requested interfaces.
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 3464e3ec56997..d96941d4c5235 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
[ ... ]
> @@ -1854,13 +1964,17 @@ struct phylink *phylink_create(struct phylink_config *config,
[ ... ]
> + /* Fill the PCS list with available PCS from phylink config */
> + ret = phylink_fill_available_pcs(pl, config);
> + if (ret < 0)
> + goto free_pl;
[ ... ]
> pl->config = config;
> if (config->type == PHYLINK_NETDEV) {
> pl->netdev = to_net_dev(config->dev);
> @@ -1882,8 +2012,7 @@ struct phylink *phylink_create(struct phylink_config *config,
> } else if (config->type == PHYLINK_DEV) {
> pl->dev = config->dev;
> } else {
> - kfree(pl);
> - return ERR_PTR(-EINVAL);
> + goto unlink_pcs_list;
[Severity: High]
Can this jump to unlink_pcs_list return an invalid pointer instead of an error?
If config->type is invalid, the code jumps to unlink_pcs_list without setting
'ret = -EINVAL'. Because 'ret' still holds the non-negative result from
phylink_fill_available_pcs(), ERR_PTR(ret) will return a valid-looking pointer
(or NULL) instead of an error pointer.
This would bypass the caller's IS_ERR() check and could lead to a crash when
they attempt to use the returned phylink pointer.
> }
>
[ ... ]
> +unlink_pcs_list:
> + list_for_each_entry(pcs, &pl->pcs_list, list)
> + pcs->phylink = NULL;
> +free_pl:
> + kfree(pl);
> + return ERR_PTR(ret);
> }
> EXPORT_SYMBOL_GPL(phylink_create);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260717065448.1498335-1-ansuelsmth@gmail.com?part=6
next prev parent reply other threads:[~2026-07-18 9:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-17 6:54 [PATCH net-next v9 00/12] net: pcs: Introduce support for fwnode PCS Christian Marangi
2026-07-17 6:54 ` [PATCH net-next v9 01/12] net: phylink: keep and use MAC supported_interfaces in phylink struct Christian Marangi
2026-07-18 9:01 ` sashiko-bot
2026-07-17 6:54 ` [PATCH net-next v9 02/12] net: phylink: introduce internal phylink PCS handling Christian Marangi
2026-07-18 9:01 ` sashiko-bot
2026-07-17 6:54 ` [PATCH net-next v9 03/12] net: phylink: add phylink_release_pcs() to externally release a PCS Christian Marangi
2026-07-18 9:01 ` sashiko-bot
2026-07-17 6:54 ` [PATCH net-next v9 04/12] net: pcs: implement Firmware node support for PCS driver Christian Marangi
2026-07-18 9:01 ` sashiko-bot
2026-07-17 6:54 ` [PATCH net-next v9 05/12] net: phylink: support late PCS provider attach Christian Marangi
2026-07-18 9:01 ` sashiko-bot
2026-07-17 6:54 ` [PATCH net-next v9 06/12] net: Document PCS subsystem Christian Marangi
2026-07-18 9:01 ` sashiko-bot [this message]
2026-07-17 6:54 ` [PATCH net-next v9 07/12] MAINTAINERS: add myself as PCS subsystem maintainer Christian Marangi
2026-07-17 6:54 ` [PATCH net-next v9 08/12] of: property: fw_devlink: Add support for "pcs-handle" Christian Marangi
2026-07-18 9:01 ` sashiko-bot
2026-07-17 6:54 ` [PATCH net-next v9 09/12] net: phylink: add .pcs_link_down PCS OP Christian Marangi
2026-07-18 9:01 ` sashiko-bot
2026-07-17 6:54 ` [PATCH net-next v9 10/12] dt-bindings: net: pcs: Document support for Airoha Ethernet PCS Christian Marangi
2026-07-17 6:54 ` [PATCH net-next v9 11/12] net: pcs: airoha: add PCS driver for Airoha AN7581 SoC Christian Marangi
2026-07-18 9:01 ` sashiko-bot
2026-07-17 6:54 ` [PATCH net-next v9 12/12] net: airoha: add phylink support Christian Marangi
2026-07-18 9:01 ` 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=20260718090117.AD06A1F00A3D@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.