Thread (21 messages) 21 messages, 4 authors, 2025-06-24

Re: [PATCH v2 01/16] drm/panel: get/put panel reference in drm_panel_add/remove()

From: Luca Ceresoli <luca.ceresoli@bootlin.com>
Date: 2025-06-20 08:34:08
Also in: dri-devel, linux-renesas-soc, linux-samsung-soc, linux-sunxi, linux-tegra, lkml

Hello Anusha,

On Thu, 19 Jun 2025 14:15:53 -0500
Anusha Srivatsa [off-list ref] wrote:
Take the panel reference and put it back as required.
drm_panel_add() and drm_panel_remove() add a panel to
the global registry and removes a panel respectively.
Use get() and put() helpers to keep up with refcounting.

Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Anusha Srivatsa <redacted>
This patch is good.

I'd just point out that this must be applied only after all drivers
have been converted to the the _alloc API, otherwise with the following
sequence:

  panel = devm_kzalloc();
  drm_panel_init(panel);
  drm_panel_add(panel);
  ...
  drm_panel_remove(panel); <-----

at the drm_panel_remove() you'd have a warning:

  refcount_t: addition on 0; use-after-free.

So, if all panel drivers are converted:
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help