lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DEYUNHVYCKYJ.2HU878WBYCJMV@bootlin.com>
Date: Mon, 15 Dec 2025 15:11:21 +0100
From: "Luca Ceresoli" <luca.ceresoli@...tlin.com>
To: "Maxime Ripard" <mripard@...nel.org>
Cc: "Andrzej Hajda" <andrzej.hajda@...el.com>, "Neil Armstrong"
 <neil.armstrong@...aro.org>, "Robert Foss" <rfoss@...nel.org>, "Laurent
 Pinchart" <Laurent.pinchart@...asonboard.com>, "Jonas Karlman"
 <jonas@...boo.se>, "Jernej Skrabec" <jernej.skrabec@...il.com>, "Maarten
 Lankhorst" <maarten.lankhorst@...ux.intel.com>, "Thomas Zimmermann"
 <tzimmermann@...e.de>, "David Airlie" <airlied@...il.com>, "Simona Vetter"
 <simona@...ll.ch>, "Jonathan Corbet" <corbet@....net>, "Alexey Brodkin"
 <abrodkin@...opsys.com>, "Phong LE" <ple@...libre.com>, "Liu Ying"
 <victor.liu@....com>, "Shawn Guo" <shawnguo@...nel.org>, "Sascha Hauer"
 <s.hauer@...gutronix.de>, "Pengutronix Kernel Team"
 <kernel@...gutronix.de>, "Fabio Estevam" <festevam@...il.com>, "Adrien
 Grassein" <adrien.grassein@...il.com>, "Laurent Pinchart"
 <laurent.pinchart+renesas@...asonboard.com>, "Tomi Valkeinen"
 <tomi.valkeinen+renesas@...asonboard.com>, "Kieran Bingham"
 <kieran.bingham+renesas@...asonboard.com>, "Geert Uytterhoeven"
 <geert+renesas@...der.be>, "Magnus Damm" <magnus.damm@...il.com>, "Kevin
 Hilman" <khilman@...libre.com>, "Jerome Brunet" <jbrunet@...libre.com>,
 "Martin Blumenstingl" <martin.blumenstingl@...glemail.com>, "Chun-Kuang Hu"
 <chunkuang.hu@...nel.org>, "Philipp Zabel" <p.zabel@...gutronix.de>,
 "Matthias Brugger" <matthias.bgg@...il.com>, "AngeloGioacchino Del Regno"
 <angelogioacchino.delregno@...labora.com>, "Anitha Chrisanthus"
 <anitha.chrisanthus@...el.com>, "Edmund Dea" <edmund.j.dea@...el.com>,
 "Inki Dae" <inki.dae@...sung.com>, "Seung-Woo Kim"
 <sw0312.kim@...sung.com>, "Kyungmin Park" <kyungmin.park@...sung.com>,
 "Krzysztof Kozlowski" <krzk@...nel.org>, "Alim Akhtar"
 <alim.akhtar@...sung.com>, "Hui Pu" <Hui.Pu@...ealthcare.com>, "Thomas
 Petazzoni" <thomas.petazzoni@...tlin.com>,
 <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
 <linux-doc@...r.kernel.org>, <imx@...ts.linux.dev>,
 <linux-arm-kernel@...ts.infradead.org>,
 <linux-renesas-soc@...r.kernel.org>, <linux-amlogic@...ts.infradead.org>,
 <linux-mediatek@...ts.infradead.org>, <linux-samsung-soc@...r.kernel.org>
Subject: Re: [PATCH 06/26] drm/bridge: add devm_drm_of_find_bridge

Hi Maxime,

On Mon Dec 15, 2025 at 11:35 AM CET, Maxime Ripard wrote:
[...]
>> > Additionally, as a matter of fact there are currently drivers storing
>> > bridge pointers. The next_bridge is the most common case. Code using
>> > drm_bridge_connector_init() for example can store up to eight of them, but
>> > individual drivers are the hardest to hunt for.
>> >
>> > I can see these (potential) tools to handle this (not mutually exclusive):
>> >
>> >  1. remove drm_bridge pointers pointing to other bridges
>> >  2. check whether a bridge (say B) still exists before any dereference
>> >     to B->another_bridge: that's drm_bridge_enter/exit()
>> >  3. let owners of bridge pointers be notified when a bridge is unplugged,
>> >     so they can actively put their reference and clear their pointer
>> >
>> > For item 1, I think the drm_of_bridge_attach() idea quoted above would
>> > work, at least for the simple cases where bridge drivers use the
>> > next_bridge only for attach. A next_bridge pointer in struct drm_bridge is
>> > not even needed in that case, the pointer would be computed from OF when
>> > needed and not stored. I can do an experiment and send a first series, do
>> > you think it would be useful?
>>
>> I had a look and, while the implementation should be simple, only a few
>> drivers could benefit right now. The majority fall into one of these
>> categories:
>>
>>  * drivers using drm_of_find_panel_or_bridge() or *_of_get_bridge()
>>    (maybe 60-80% of all drivers, those will have to wait for the panel
>>    improvements)
>>  * drivers using the next_bridge pointer for more than just attach
>>  * drivers doing more complicated stuff
>>
>> I think your "put next_bridge in __drm_bridge_free" idea would fit well the
>> 2nd category and perhaps also the 1st one. For the 3rd category we'd need
>> something different, e.g. a per-driver .destroy callback.
>
> Yep, that's fine. We should optimize for the common case, with an escape
> hatch. That's exactly what we are talking about here.

Not sure why, but it's taking a while before I grasp your ideas about this
series and meld them with mine. I hopefully got a clear POV now, so based
on it my plan is to rework this series to:

 * keep drm_of_find_bridge() but renamed to of_drm_get_bridge(), and keep
   patches 1-5 (with the changes suggested by you and Louis, nothing big
   and all already sent in v2)
 * not add devm_drm_of_find_bridge()
 * add next_bridge pointer to struct drm_bridge and call
   drm_bridge_put(bridge->next_bridge) in __drm_bridge_free, document it
 * convert patches 7-26 to use bridge->next_bridge where applicable,
   or to do something different when needed
 * maybe remove part of patches 7-26 just to reduce spam and rework effort
   in case of further iterations, to send them separately once the approach
   is accepted

Does it look OK?

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ