Skip to content

drm/meson: fix use-after-free driver unload issues

Adrián Larumbe dri-devel linux-amlogic 1 version Applied

Status from this message: Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 6 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/3drm/meson: reorder driver deinit sequence to fix use-after-free bugdrivers/gpu/drm/meson/meson_drv.c+1 -11 reply
2/3drm/meson: explicitly remove aggregate driver at module unload timedrivers/gpu/drm/meson/meson_drv.c+8 -01 reply
3/3drm/meson: remove drm bridges at aggregate driver unbind timedrivers/gpu/drm/meson/meson_drv.c drivers/gpu/drm/meson/meson_drv.h drivers/gpu/drm/meson/meson_encoder_cvbs.c +4 more+42 -05 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchNeil Armstrong
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] drm/meson: fix use-after-free driver unload issues

This patch series tries to fix some use-after-free bugs I've observed with the help of KASAN in Amlogic's KMS DRM driver.

The first patch in the series reorders the driver deinitialisation sequence so that devres won't deallocate things that are still expected to be around by a later call to drm_dev_put.

The second patch adds a missing call to component_master_del inside a new driver's remove callback.

The third patch makes sure some drm bridges added during driver initialisation are removed at module unload time, to make sure the global bridge list doesn't keep nodes to freed memory.

All three patches have been tested on an Odroid N2+ plus SBC.

Adrián Larumbe (3):
drm/meson: reorder driver deinit sequence to fix use-after-free bug drm/meson: explicitly remove aggregate driver at module unload time drm/meson: remove drm bridges at aggregate driver unbind time

 drivers/gpu/drm/meson/meson_drv.c          | 14 +++++++++++++-
 drivers/gpu/drm/meson/meson_drv.h          |  7 +++++++
 drivers/gpu/drm/meson/meson_encoder_cvbs.c |  7 +++++++
 drivers/gpu/drm/meson/meson_encoder_cvbs.h |  1 +
 drivers/gpu/drm/meson/meson_encoder_hdmi.c |  7 +++++++
 drivers/gpu/drm/meson/meson_encoder_hdmi.h |  1 +
 drivers/gpu/drm/meson/meson_venc.h         | 15 +++++++++++++++
 7 files changed, 51 insertions(+), 1 deletion(-)
Signature · 1 line
2.37.0