From: sashiko-bot@kernel.org
To: "Chaoyi Chen" <kernel@airkyi.com>
Cc: neil.armstrong@linaro.org, dri-devel@lists.freedesktop.org,
linux-phy@lists.infradead.org, olteanv@gmail.com,
vkoul@kernel.org
Subject: Re: [PATCH v6 5/7] phy: rockchip: phy-rockchip-typec: Add DRM AUX bridge
Date: Tue, 04 Aug 2026 07:32:07 +0000 [thread overview]
Message-ID: <20260804073208.9BD3F1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260804070730.68-6-kernel@airkyi.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Passing `child_np` to `drm_aux_bridge_register_from_node()` without acquiring an additional reference leads to a refcount underflow and potential double-free.
- [Medium] The result of `devm_phy_create()` is not checked immediately, leading to potential error shadowing and broken probe deferral.
--
--- Patch [5]: [PATCH v6 5/7] phy: rockchip: phy-rockchip-typec: Add DRM AUX bridge ---
commit ed030870fca01a8999b3193c38becaaeb4276a91
Author: Chaoyi Chen <chaoyi.chen@rock-chips.com>
phy: rockchip: phy-rockchip-typec: Add DRM AUX bridge
Using the DRM_AUX_BRIDGE helper to create the transparent DRM bridge
device.
> diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
> index d9701b6106d55..48070b50416e5 100644
> --- a/drivers/phy/rockchip/phy-rockchip-typec.c
> +++ b/drivers/phy/rockchip/phy-rockchip-typec.c
[ ... ]
> @@ -1162,16 +1163,24 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
>
> for_each_available_child_of_node(np, child_np) {
> struct phy *phy;
> + ret = 0;
>
> - if (of_node_name_eq(child_np, "dp-port"))
> + if (of_node_name_eq(child_np, "dp-port")) {
> phy = devm_phy_create(dev, child_np,
> &rockchip_dp_phy_ops);
> - else if (of_node_name_eq(child_np, "usb3-port"))
> + ret = drm_aux_bridge_register_from_node(dev, child_np);
[Severity: Medium]
Should we check if devm_phy_create() failed before registering the bridge?
If devm_phy_create() fails with an error like -EPROBE_DEFER, but
drm_aux_bridge_register_from_node() also fails, the code below checks 'ret'
first and returns that error. This could shadow the -EPROBE_DEFER from the
PHY creation and prevent the driver from properly probing again.
[Severity: High]
Does this code need to call of_node_get() on child_np before passing it here?
The for_each_available_child_of_node() loop only holds a reference to child_np
during the current iteration, dropping it when advancing to the next node.
However, drm_aux_bridge_register_from_node() assigns the node to the bridge
device without incrementing the reference count, and later calls of_node_put()
in its release callback.
Will this lead to a refcount underflow and use-after-free of the node memory
once the loop advances?
> + } else if (of_node_name_eq(child_np, "usb3-port"))
> phy = devm_phy_create(dev, child_np,
> &rockchip_usb3_phy_ops);
> else
> continue;
>
> + if (ret) {
> + pm_runtime_disable(dev);
> + of_node_put(child_np);
[Severity: High]
If drm_aux_bridge_register_from_node() fails, does this cause a double-free
of the OF node?
Because the loop reference was passed directly to the bridge registration
without incrementing the reference count, and the bridge already calls
of_node_put() on its own internal error path, calling of_node_put() here
again will drop the reference count a second time.
> + return ret;
> + }
> +
> if (IS_ERR(phy)) {
> dev_err(dev, "failed to create phy: %pOFn\n",
> child_np);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804070730.68-1-kernel@airkyi.com?part=5
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Chaoyi Chen" <kernel@airkyi.com>
Cc: neil.armstrong@linaro.org, dri-devel@lists.freedesktop.org,
linux-phy@lists.infradead.org, olteanv@gmail.com,
vkoul@kernel.org
Subject: Re: [PATCH v6 5/7] phy: rockchip: phy-rockchip-typec: Add DRM AUX bridge
Date: Tue, 04 Aug 2026 07:32:07 +0000 [thread overview]
Message-ID: <20260804073208.9BD3F1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260804070730.68-6-kernel@airkyi.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Passing `child_np` to `drm_aux_bridge_register_from_node()` without acquiring an additional reference leads to a refcount underflow and potential double-free.
- [Medium] The result of `devm_phy_create()` is not checked immediately, leading to potential error shadowing and broken probe deferral.
--
--- Patch [5]: [PATCH v6 5/7] phy: rockchip: phy-rockchip-typec: Add DRM AUX bridge ---
commit ed030870fca01a8999b3193c38becaaeb4276a91
Author: Chaoyi Chen <chaoyi.chen@rock-chips.com>
phy: rockchip: phy-rockchip-typec: Add DRM AUX bridge
Using the DRM_AUX_BRIDGE helper to create the transparent DRM bridge
device.
> diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
> index d9701b6106d55..48070b50416e5 100644
> --- a/drivers/phy/rockchip/phy-rockchip-typec.c
> +++ b/drivers/phy/rockchip/phy-rockchip-typec.c
[ ... ]
> @@ -1162,16 +1163,24 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
>
> for_each_available_child_of_node(np, child_np) {
> struct phy *phy;
> + ret = 0;
>
> - if (of_node_name_eq(child_np, "dp-port"))
> + if (of_node_name_eq(child_np, "dp-port")) {
> phy = devm_phy_create(dev, child_np,
> &rockchip_dp_phy_ops);
> - else if (of_node_name_eq(child_np, "usb3-port"))
> + ret = drm_aux_bridge_register_from_node(dev, child_np);
[Severity: Medium]
Should we check if devm_phy_create() failed before registering the bridge?
If devm_phy_create() fails with an error like -EPROBE_DEFER, but
drm_aux_bridge_register_from_node() also fails, the code below checks 'ret'
first and returns that error. This could shadow the -EPROBE_DEFER from the
PHY creation and prevent the driver from properly probing again.
[Severity: High]
Does this code need to call of_node_get() on child_np before passing it here?
The for_each_available_child_of_node() loop only holds a reference to child_np
during the current iteration, dropping it when advancing to the next node.
However, drm_aux_bridge_register_from_node() assigns the node to the bridge
device without incrementing the reference count, and later calls of_node_put()
in its release callback.
Will this lead to a refcount underflow and use-after-free of the node memory
once the loop advances?
> + } else if (of_node_name_eq(child_np, "usb3-port"))
> phy = devm_phy_create(dev, child_np,
> &rockchip_usb3_phy_ops);
> else
> continue;
>
> + if (ret) {
> + pm_runtime_disable(dev);
> + of_node_put(child_np);
[Severity: High]
If drm_aux_bridge_register_from_node() fails, does this cause a double-free
of the OF node?
Because the loop reference was passed directly to the bridge registration
without incrementing the reference count, and the bridge already calls
of_node_put() on its own internal error path, calling of_node_put() here
again will drop the reference count a second time.
> + return ret;
> + }
> +
> if (IS_ERR(phy)) {
> dev_err(dev, "failed to create phy: %pOFn\n",
> child_np);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804070730.68-1-kernel@airkyi.com?part=5
next prev parent reply other threads:[~2026-08-04 7:32 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 7:07 [PATCH v6 0/7] drm/bridge: Implement generic USB Type-C DP HPD bridge Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:07 ` [PATCH v6 1/7] drm/bridge: aux-hpd-bridge: Add drm_dev_has_dp_hpd_bridge() Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-06 17:56 ` Sebastian Reichel
2026-08-06 17:56 ` Sebastian Reichel
2026-08-06 17:56 ` Sebastian Reichel
2026-08-04 7:07 ` [PATCH v6 2/7] drm/bridge: Implement generic USB Type-C DP HPD bridge Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:25 ` sashiko-bot
2026-08-04 7:25 ` sashiko-bot
2026-08-06 18:00 ` Sebastian Reichel
2026-08-06 18:00 ` Sebastian Reichel
2026-08-06 18:00 ` Sebastian Reichel
2026-08-04 7:07 ` [PATCH v6 3/7] drm/display: Add soft depend for aux-hpd-typec-dp-bridge module Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:19 ` sashiko-bot
2026-08-04 7:19 ` sashiko-bot
2026-08-06 18:01 ` Sebastian Reichel
2026-08-06 18:01 ` Sebastian Reichel
2026-08-06 18:01 ` Sebastian Reichel
2026-08-04 7:07 ` [PATCH v6 4/7] drm/bridge: aux: Add drm_aux_bridge_register_from_node() Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:22 ` sashiko-bot
2026-08-04 7:22 ` sashiko-bot
2026-08-04 7:07 ` [PATCH v6 5/7] phy: rockchip: phy-rockchip-typec: Add DRM AUX bridge Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:32 ` sashiko-bot [this message]
2026-08-04 7:32 ` sashiko-bot
2026-08-06 15:52 ` Vinod Koul
2026-08-06 15:52 ` Vinod Koul
2026-08-06 15:52 ` Vinod Koul
2026-08-04 7:07 ` [PATCH v6 6/7] drm/rockchip: cdn-dp: Support handle lane info without extcon Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:35 ` sashiko-bot
2026-08-04 7:35 ` sashiko-bot
2026-08-04 7:07 ` [PATCH v6 7/7] drm/rockchip: cdn-dp: Add multiple bridges to support PHY port selection Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:07 ` Chaoyi Chen
2026-08-04 7:38 ` sashiko-bot
2026-08-04 7:38 ` 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=20260804073208.9BD3F1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@airkyi.com \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@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 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.