mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 0/5] drm/mediatek: Cleanups and sanitization
@ 2025-04-02  8:36 AngeloGioacchino Del Regno
  2025-04-02  8:36 ` [PATCH v1 1/5] drm/mediatek: mtk_drm_drv: Fix kobject put for mtk_mutex device ptr AngeloGioacchino Del Regno
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-02  8:36 UTC (permalink / raw)
  To: chunkuang.hu
  Cc: p.zabel, airlied, simona, matthias.bgg,
	angelogioacchino.delregno, nancy.lin, ck.hu, djkurtz, littlecvr,
	bibby.hsieh, dri-devel, linux-mediatek, linux-kernel,
	linux-arm-kernel, wenst, kernel

During probe, the mediatek-drm drivers take a bunch of kobject
references for the various component sub-drivers and for the
mmsys/mutex handles.

Unfortunately, the refcount is not correctly decremented in some
cases, and not correctly incremented in some others, leading to
refcount_t overflows *or* underflows depending on where the code
fails during platform driver probe or during component bind.

This means that if mediatek-drm or any component of it returns a
probe deferral, and if this happens "too many times" (where too
many equals to around 3-5 times, and that's happening especially
when outer drivers are compiled as module while mediatek-drm is
built-in), it creates a whole bunch of badnesses.

This series sanitizes the freeing of the acquired kobjects in
mediatek-drm - especially in the multi-mmsys (multi-vdo) case.

While at it, this also moves the ISR enablement and disablement
to the component bind/unbind callbacks respectively, while keeping
the ISR installation to the probe function: this is done to avoid
leaks and to avoid entering ISRs for OVL/RDMA after those are
unbound (as that'd be dangerous, other than useless, because those
could access memory that doesn't belong to those drivers anymore,
as pointers may not have been set to NULL...!).

As an example, this is the reason (if not one of the reasons) for
a boot failure seen on the MT8195 Tomato Chromebook, pointed out
by KernelCI.

AngeloGioacchino Del Regno (5):
  drm/mediatek: mtk_drm_drv: Fix kobject put for mtk_mutex device ptr
  drm/mediatek: Fix kobject put for component sub-drivers
  drm/mediatek: mtk_drm_drv: Unbind secondary mmsys components on err
  drm/mediatek: mtk_disp_ovl: Enable/disable interrupt on bind/unbind
  drm/mediatek: mtk_disp_rdma: Enable/disable interrupt on bind/unbind

 drivers/gpu/drm/mediatek/mtk_disp_ovl.c  | 19 +++++++++----
 drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 35 ++++++++++++++----------
 drivers/gpu/drm/mediatek/mtk_drm_drv.c   | 31 +++++++++++++++------
 3 files changed, 57 insertions(+), 28 deletions(-)

-- 
2.48.1


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

end of thread, other threads:[~2025-04-02 10:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-02  8:36 [PATCH v1 0/5] drm/mediatek: Cleanups and sanitization AngeloGioacchino Del Regno
2025-04-02  8:36 ` [PATCH v1 1/5] drm/mediatek: mtk_drm_drv: Fix kobject put for mtk_mutex device ptr AngeloGioacchino Del Regno
2025-04-02 10:14   ` Chen-Yu Tsai
2025-04-02  8:36 ` [PATCH v1 2/5] drm/mediatek: Fix kobject put for component sub-drivers AngeloGioacchino Del Regno
2025-04-02 10:18   ` Chen-Yu Tsai
2025-04-02  8:36 ` [PATCH v1 3/5] drm/mediatek: mtk_drm_drv: Unbind secondary mmsys components on err AngeloGioacchino Del Regno
2025-04-02 10:19   ` Chen-Yu Tsai
2025-04-02  8:36 ` [PATCH v1 4/5] drm/mediatek: mtk_disp_ovl: Enable/disable interrupt on bind/unbind AngeloGioacchino Del Regno
2025-04-02  9:38   ` Chen-Yu Tsai
2025-04-02 10:08     ` AngeloGioacchino Del Regno
2025-04-02  8:36 ` [PATCH v1 5/5] drm/mediatek: mtk_disp_rdma: " AngeloGioacchino Del Regno
2025-04-02  9:42   ` Chen-Yu Tsai

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

all inboxes | Powered by JetHome®