From: sashiko-bot@kernel.org
To: "Chaoyi Chen" <kernel@airkyi.com>
Cc: olteanv@gmail.com, dri-devel@lists.freedesktop.org,
vkoul@kernel.org, neil.armstrong@linaro.org,
linux-phy@lists.infradead.org
Subject: Re: [PATCH v5 3/6] drm/bridge: aux: Add drm_aux_bridge_register_from_node()
Date: Thu, 30 Jul 2026 01:42:56 +0000 [thread overview]
Message-ID: <20260730014257.089BE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260730013349.51-4-kernel@airkyi.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unbalanced `of_node_put()` on the provided device node `np` leads to reference count underflow and potential use-after-free.
--
--- Patch [3]: [PATCH v5 3/6] drm/bridge: aux: Add drm_aux_bridge_register_from_node() ---
commit 73b014949499087c9b0b99c49dc18c4868428dcd
Author: Chaoyi Chen <chaoyi.chen@rock-chips.com>
drm/bridge: aux: Add drm_aux_bridge_register_from_node()
This patch introduces a new function to register an auxiliary bridge using
a specifically provided device node, instead of defaulting to the parent's
device node.
> 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 path cause a reference count underflow on the provided device node?
When np is provided, device_set_node() simply assigns the node pointer
without taking a reference via of_node_get(). In contrast, the fallback
path device_set_of_node_from_dev() properly acquires a reference.
Both the error path below (when auxiliary_device_init() fails) and the
normal device release callback drm_aux_bridge_release() unconditionally
call of_node_put(adev->dev.of_node). This drops a reference that was never
acquired in the np != NULL branch.
If the API intended to consume a reference from the caller, the error
paths appear to be structurally broken: failure in ida_alloc() does not
drop the reference, but failure in auxiliary_device_init() does, leaving
the caller unable to know if it should clean up the reference.
Should we add an of_node_get() here?
> + else
> + device_set_of_node_from_dev(&adev->dev, parent);
>
> ret = auxiliary_device_init(adev);
> if (ret) {
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260730013349.51-1-kernel@airkyi.com?part=3
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-07-30 1:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 1:33 [PATCH v5 0/6] drm/bridge: Implement generic USB Type-C DP HPD bridge Chaoyi Chen
2026-07-30 1:33 ` [PATCH v5 1/6] " Chaoyi Chen
2026-07-30 1:50 ` sashiko-bot
2026-07-30 1:33 ` [PATCH v5 2/6] drm/display: Add soft depend for aux-hpd-typec-dp-bridge module Chaoyi Chen
2026-07-30 1:33 ` [PATCH v5 3/6] drm/bridge: aux: Add drm_aux_bridge_register_from_node() Chaoyi Chen
2026-07-30 1:42 ` sashiko-bot [this message]
2026-07-30 1:33 ` [PATCH v5 4/6] phy: rockchip: phy-rockchip-typec: Add DRM AUX bridge Chaoyi Chen
2026-07-30 1:47 ` sashiko-bot
2026-07-30 1:33 ` [PATCH v5 5/6] drm/rockchip: cdn-dp: Support handle lane info without extcon Chaoyi Chen
2026-07-30 1:46 ` sashiko-bot
2026-07-30 1:33 ` [PATCH v5 6/6] drm/rockchip: cdn-dp: Add multiple bridges to support PHY port selection Chaoyi Chen
2026-07-30 1: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=20260730014257.089BE1F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox