From: sashiko-bot@kernel.org
To: "Chaoyi Chen" <kernel@airkyi.com>
Cc: dri-devel@lists.freedesktop.org, linux-phy@lists.infradead.org,
olteanv@gmail.com, vkoul@kernel.org, neil.armstrong@linaro.org
Subject: Re: [PATCH v6 4/7] drm/bridge: aux: Add drm_aux_bridge_register_from_node()
Date: Tue, 04 Aug 2026 07:22:50 +0000 [thread overview]
Message-ID: <20260804072251.4BFC71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804070730.68-5-kernel@airkyi.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm_aux_bridge_register_from_node() assigns the provided device node without taking a reference, leading to a reference count underflow when the device is released or initialization fails.
--
--- Patch [4]: [PATCH v6 4/7] drm/bridge: aux: Add drm_aux_bridge_register_from_node() ---
commit 589f6bc20e86e41fcd3fb17c01ef52cecefa8a82
Author: Chaoyi Chen <chaoyi.chen@rock-chips.com>
drm/bridge: aux: Add drm_aux_bridge_register_from_node()
This commit introduces drm_aux_bridge_register_from_node() to allow
specifying the of_node corresponding to the bridge, extending the
existing drm_aux_bridge_register() functionality.
> diff --git a/drivers/gpu/drm/bridge/aux-bridge.c b/drivers/gpu/drm/bridge/aux-bridge.c
> index 1ed21a8713bfd..06a1466f49bd2 100644
> --- a/drivers/gpu/drm/bridge/aux-bridge.c
> +++ b/drivers/gpu/drm/bridge/aux-bridge.c
[ ... ]
> @@ -62,7 +63,10 @@ int drm_aux_bridge_register(struct device *parent)
> adev->dev.parent = parent;
> adev->dev.release = drm_aux_bridge_release;
>
> - device_set_of_node_from_dev(&adev->dev, parent);
> + if (np)
> + device_set_node(&adev->dev, of_fwnode_handle(np));
[Severity: High]
Does this code need to take a reference on np before setting it?
Looking at device_set_of_node_from_dev(), it correctly acquires a reference
using of_node_get(). However, device_set_node() only assigns the pointer
without taking a reference.
If initialization fails, the error path unconditionally drops a reference:
ret = auxiliary_device_init(adev);
if (ret) {
of_node_put(adev->dev.of_node);
...
Additionally, drm_aux_bridge_release() unconditionally calls of_node_put()
when the device is released.
Could assigning the node here without of_node_get() cause a reference count
underflow and a potential use-after-free for the provided node?
> + else
> + device_set_of_node_from_dev(&adev->dev, parent);
>
> ret = auxiliary_device_init(adev);
> if (ret) {
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804070730.68-1-kernel@airkyi.com?part=4
--
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: dri-devel@lists.freedesktop.org, linux-phy@lists.infradead.org,
olteanv@gmail.com, vkoul@kernel.org, neil.armstrong@linaro.org
Subject: Re: [PATCH v6 4/7] drm/bridge: aux: Add drm_aux_bridge_register_from_node()
Date: Tue, 04 Aug 2026 07:22:50 +0000 [thread overview]
Message-ID: <20260804072251.4BFC71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804070730.68-5-kernel@airkyi.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm_aux_bridge_register_from_node() assigns the provided device node without taking a reference, leading to a reference count underflow when the device is released or initialization fails.
--
--- Patch [4]: [PATCH v6 4/7] drm/bridge: aux: Add drm_aux_bridge_register_from_node() ---
commit 589f6bc20e86e41fcd3fb17c01ef52cecefa8a82
Author: Chaoyi Chen <chaoyi.chen@rock-chips.com>
drm/bridge: aux: Add drm_aux_bridge_register_from_node()
This commit introduces drm_aux_bridge_register_from_node() to allow
specifying the of_node corresponding to the bridge, extending the
existing drm_aux_bridge_register() functionality.
> diff --git a/drivers/gpu/drm/bridge/aux-bridge.c b/drivers/gpu/drm/bridge/aux-bridge.c
> index 1ed21a8713bfd..06a1466f49bd2 100644
> --- a/drivers/gpu/drm/bridge/aux-bridge.c
> +++ b/drivers/gpu/drm/bridge/aux-bridge.c
[ ... ]
> @@ -62,7 +63,10 @@ int drm_aux_bridge_register(struct device *parent)
> adev->dev.parent = parent;
> adev->dev.release = drm_aux_bridge_release;
>
> - device_set_of_node_from_dev(&adev->dev, parent);
> + if (np)
> + device_set_node(&adev->dev, of_fwnode_handle(np));
[Severity: High]
Does this code need to take a reference on np before setting it?
Looking at device_set_of_node_from_dev(), it correctly acquires a reference
using of_node_get(). However, device_set_node() only assigns the pointer
without taking a reference.
If initialization fails, the error path unconditionally drops a reference:
ret = auxiliary_device_init(adev);
if (ret) {
of_node_put(adev->dev.of_node);
...
Additionally, drm_aux_bridge_release() unconditionally calls of_node_put()
when the device is released.
Could assigning the node here without of_node_get() cause a reference count
underflow and a potential use-after-free for the provided node?
> + else
> + device_set_of_node_from_dev(&adev->dev, parent);
>
> ret = auxiliary_device_init(adev);
> if (ret) {
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804070730.68-1-kernel@airkyi.com?part=4
next prev parent reply other threads:[~2026-08-04 7:22 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 [this message]
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
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=20260804072251.4BFC71F000E9@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.