dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/stm: Fix potential use-after-free of pending IRQ threads
@ 2026-12-03 11:58 Guangshuo Li
  2026-12-03 12:25 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Guangshuo Li @ 2026-12-03 11:58 UTC (permalink / raw)
  To: yannick.fertre, raphael.gallais-pou, philippe.cornu,
	maarten.lankhorst, mripard, tzimmermann, airlied, simona,
	mcoquelin.stm32, alexandre.torgue
  Cc: eric, neil.armstrong, dri-devel, linux-stm32, linux-arm-kernel

Disabling the LTDC interrupt source during removal does not wait for
an already awakened IRQ thread. The thread can still access the DRM
device and its managed data after stm_drm_platform_remove() drops the
last device reference.

Release the managed IRQs in ltdc_unload() before the DRM device is put.

Fixes: b759012c5fa7 ("drm/stm: Add STM32 LTDC driver")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
 drivers/gpu/drm/stm/ltdc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index 5311e0b3e8dc..35aa33f4c459 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -2103,8 +2103,15 @@ int ltdc_load(struct drm_device *ddev)
 
 void ltdc_unload(struct drm_device *ddev)
 {
+	struct platform_device *pdev = to_platform_device(ddev->dev);
+	struct ltdc_device *ldev = ddev->dev_private;
+	int i;
+
 	drm_dbg_driver(ddev, "\n");
 
+	for (i = 0; i < ldev->caps.nb_irq; i++)
+		devm_free_irq(ddev->dev, platform_get_irq(pdev, i), ddev);
+
 	pm_runtime_disable(ddev->dev);
 }
 

base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-03 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 11:58 [PATCH] drm/stm: Fix potential use-after-free of pending IRQ threads Guangshuo Li
2026-12-03 12:25 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox