From: Liu Ying <victor.liu@nxp.com>
To: Marco Felsch <m.felsch@pengutronix.de>,
Luca Ceresoli <luca.ceresoli@bootlin.com>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>, Peng Fan <peng.fan@nxp.com>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Frank Li <Frank.Li@nxp.com>,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v11 2/3] drm/bridge: imx: Add i.MX93 parallel display format configuration support
Date: Thu, 12 Mar 2026 17:15:33 +0800 [thread overview]
Message-ID: <ccce0f8c-88bf-4cd8-a806-b62049606cfe@nxp.com> (raw)
In-Reply-To: <ot5qypkeirkiweicjijholt2hwfpnnfhrcm3d6euqfnupptsab@din4bkq2sh5h>
On Wed, Mar 11, 2026 at 08:45:25PM +0100, Marco Felsch wrote:
> Hi Liu, Luca,
Hi,
>
> sorry for the delayed response, I was at the EW26.
Np at all, it's good to go out to meet people sometimes :)
>
> On 26-03-10, Luca Ceresoli wrote:
>> Hi Liu, Marco,
>>
>> On Tue Mar 10, 2026 at 3:57 AM CET, Liu Ying wrote:
>>> Hi Marco, Luca,
>>>
>>> On Tue, Mar 03, 2026 at 11:34:27AM +0100, Marco Felsch wrote:
>>>
>>> [...]
>>>
>>>> + next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0);
>>>> + if (IS_ERR(next_bridge))
>>>> + return dev_err_probe(dev, PTR_ERR(next_bridge),
>>>> + "failed to get next bridge\n");
>>>> + pdfc->dev = dev;
>>>> + pdfc->bridge.of_node = dev->of_node;
>>>> + pdfc->bridge.type = DRM_MODE_CONNECTOR_DPI;
>>>> + pdfc->bridge.next_bridge = next_bridge;
>>>
>>> When I was reviewing another patch[1], I was aware of the necessity of
>>> calling drm_bridge_get() for next_bridge to balance the next bridge's
>>> refcount put from __drm_bridge_free() for this bridge. I'd be good if
>>> Luca may confirm this is correct. Sorry for bringing this up late.
>>
>> Indeed you have a good point.
>
> At which stage did you faced this issue? During driver probe, because of
> EPROBE_DEFER?
I just want to balance the get/put for the next bridge's refcount by
calling drm_bridge_get() for next_bridge, as I said above. There could
be some way to trigger some particular Use-After-Free issues if you don't
do that. I did take some time today to try to trigger UAF, but no luck,
though I found a potential bug in encoder_bridges_show() and generated a
fix[1](Cc'ed Marco) when I played with debugfs to read the refcounts.
My idea to trigger UAF is to remove imx_lcdif/imx93_pdfc/simple_panel
modules when doing pageflips. Dunno if EPROBE_DEFER may trigger UAF.
[1] https://lore.kernel.org/all/20260312-drm-misc-next-2026-03-05-fix-encoder-bridges-refcount-v1-1-b9ba3d844732@nxp.com/
>
> That's the reason for having the local next_bridge variable since I
> faced with the same issue. In other words this driver is correct and
> it's on purpose to not assign it directly. Albeit I could/should have
> added a comment.
What's the issue your faced? How would using next_bridge variable impact?
Without knowing these info, I presume that you still need to call
drm_bridge_get() for next_bridge, since it's kind of obvious if you take
a look at __drm_bridge_free().
>
>> After re-checking devm_drm_of_get_bridge(), as I wrote on the other thread
>> you pointed to, you should call drm_bridge_get():
>>
>> - pdfc->bridge.next_bridge = next_bridge;
>> + pdfc->bridge.next_bridge = drm_bridge_get(next_bridge);
>>
>> Marco, you can keep my R-by if you resend with just this change.
>>
>> Sorry about the confusion here.
>>
>> As mention on the other thread, devm_drm_of_get_bridge() is unable to
>> support bridge hotplug. So it should be deprecated, but as of now there is
>> no alternative.
>
> Sorry I need a bit more context. What's the issue? How can I trigger the
> issue? Why is bridge hotplug required at this stage? Why is only this
> bridge affecte by the hotplug issue?
Maybe, Luca can comment here.
>
> Regards,
> Marco
>
>
>
>>
>> Luca
>>
>> --
>> Luca Ceresoli, Bootlin
>> Embedded Linux and Kernel engineering
>> https://bootlin.com/
>>
>
--
Regards,
Liu Ying
next prev parent reply other threads:[~2026-03-12 9:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-03 10:34 [PATCH v11 0/3] Add i.MX91/93 parallel display support Marco Felsch
2026-03-03 10:34 ` [PATCH v11 1/3] dt-bindings: soc: imx93-media-blk-ctrl: Add PDFC subnode to schema and example Marco Felsch
2026-03-03 21:00 ` Frank Li
2026-03-04 15:48 ` Krzysztof Kozlowski
2026-03-04 15:49 ` Krzysztof Kozlowski
2026-03-04 17:04 ` Frank Li
2026-03-03 10:34 ` [PATCH v11 2/3] drm/bridge: imx: Add i.MX93 parallel display format configuration support Marco Felsch
2026-03-03 21:00 ` Frank Li
2026-03-03 21:22 ` Marco Felsch
2026-03-03 22:07 ` Frank Li
2026-03-03 22:20 ` Frank Li
2026-03-04 3:29 ` Liu Ying
2026-03-04 3:53 ` Frank Li
2026-03-04 3:32 ` Liu Ying
2026-03-05 14:37 ` Alexander Stein
2026-03-10 2:57 ` Liu Ying
2026-03-10 11:53 ` Luca Ceresoli
2026-03-11 3:15 ` Liu Ying
2026-03-11 19:45 ` Marco Felsch
2026-03-12 9:15 ` Liu Ying [this message]
2026-03-12 16:41 ` Luca Ceresoli
2026-03-03 10:34 ` [PATCH v11 3/3] arm64: dts: imx93: Add parallel display output nodes Marco Felsch
2026-03-03 10:42 ` Marco Felsch
2026-03-03 15:45 ` Frank Li
2026-03-03 15:50 ` Marco Felsch
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=ccce0f8c-88bf-4cd8-a806-b62049606cfe@nxp.com \
--to=victor.liu@nxp.com \
--cc=Frank.Li@nxp.com \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kernel@pengutronix.de \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=m.felsch@pengutronix.de \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=peng.fan@nxp.com \
--cc=rfoss@kernel.org \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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