Hi,

Here is a series that address multiple issues when trying to unbind/rebind
vc4-related devices to their drivers.

Most of these issues involve either use-after-free, improper resource
liberation or similar.

It has been tested on the Pi3 and Pi4, with X and glxgears running and KASAN
enabled to properly validate our memory accesses.

Pi3 isn't functional after a rebind though, with vblank timeouts occuring. I'm
not quite sure why at this point, but at least the kernel doesn't completely
crash now.

Let me know what you think,
Maxime

Maxime Ripard (64):
  drm/mipi-dsi: Detach devices when removing the host
  drm/crtc: Introduce drmm_crtc_init_with_planes
  drm/encoder: Introduce drmm_encoder_init
  drm/connector: Reorder headers
  drm/connector: Mention the cleanup after drm_connector_init
  drm/connector: Introduce drmm_connector_init
  drm/connector: Introduce drmm_connector_init_with_ddc
  drm/writeback: Introduce drmm_writeback_connector_init
  drm/simple: Introduce drmm_simple_encoder_init
  drm/bridge: panel: Introduce drmm_panel_bridge_add
  drm/bridge: panel: Introduce drmm_of_get_bridge
  drm/vc4: Call component_unbind_all()
  drm/vc4: hvs: Protect device resources after removal
  drm/vc4: hvs: Remove planes currently allocated before taking down
  drm/vc4: plane: Take possible_crtcs as an argument
  drm/vc4: plane: Switch to drmm_universal_plane_alloc()
  drm/vc4: crtc: Move debugfs_name to crtc_data
  drm/vc4: crtc: Switch to drmm_kzalloc
  drm/vc4: crtc: Switch to DRM-managed CRTC initialization
  drm/vc4: dpi: Remove vc4_dev dpi pointer
  drm/vc4: dpi: Embed DRM structures into the private structure
  drm/vc4: dpi: Switch to drmm_kzalloc
  drm/vc4: dpi: Return an error if we can't enable our clock
  drm/vc4: dpi: Remove unnecessary drm_of_panel_bridge_remove call
  drm/vc4: dpi: Add action to disable the clock
  drm/vc4: dpi: Switch to DRM-managed encoder initialization
  drm/vc4: dpi: Switch to drmm_of_get_bridge
  drm/vc4: dpi: Protect device resources
  drm/vc4: dsi: Embed DRM structures into the private structure
  drm/vc4: dsi: Switch to DRM-managed encoder initialization
  drm/vc4: dsi: Switch to drmm_of_get_bridge
  drm/vc4: dsi: Fix the driver structure lifetime
  drm/vc4: dsi: Switch to devm_pm_runtime_enable
  drm/vc4: hdmi: Switch to drmm_kzalloc
  drm/vc4: hdmi: Switch to DRM-managed encoder initialization
  drm/vc4: hdmi: Switch to DRM-managed connector initialization
  drm/vc4: hdmi: Switch to device-managed ALSA initialization
  drm/vc4: hdmi: Switch to device-managed CEC initialization
  drm/vc4: hdmi: Use a device-managed action for DDC
  drm/vc4: hdmi: Switch to DRM-managed kfree to build regsets
  drm/vc4: hdmi: Use devm to register hotplug interrupts
  drm/vc4: hdmi: Move audio structure offset checks
  drm/vc4: hdmi: Protect device resources after removal
  drm/vc4: hdmi: Switch to devm_pm_runtime_enable
  drm/vc4: txp: Remove vc4_dev txp pointer
  drm/vc4: txp: Remove duplicate regset
  drm/vc4: txp: Switch to drmm_kzalloc
  drm/vc4: txp: Switch to DRM-managed writeback initialization
  drm/vc4: txp: Protect device resources
  drm/vc4: vec: Remove vc4_dev vec pointer
  drm/vc4: vec: Embed DRM structures into the private structure
  drm/vc4: vec: Switch to drmm_kzalloc
  drm/vc4: vec: Switch to DRM-managed encoder initialization
  drm/vc4: vec: Switch to DRM-managed connector initialization
  drm/vc4: vec: Protect device resources after removal
  drm/vc4: vec: Switch to devm_pm_runtime_enable
  drm/vc4: debugfs: Protect device resources
  drm/vc4: debugfs: Return an error on failure
  drm/vc4: debugfs: Simplify debugfs registration
  drm/vc4: Switch to drmm_mutex_init
  drm/vc4: perfmon: Add missing mutex_destroy
  drm/vc4: v3d: Stop disabling interrupts
  drm/vc4: v3d: Rework the runtime_pm setup
  drm/vc4: v3d: Switch to devm_pm_runtime_enable

 drivers/gpu/drm/bridge/panel.c          |  74 +++
 drivers/gpu/drm/drm_connector.c         | 186 +++++--
 drivers/gpu/drm/drm_crtc.c              |  70 ++-
 drivers/gpu/drm/drm_encoder.c           |  48 +-
 drivers/gpu/drm/drm_mipi_dsi.c          |   1 +
 drivers/gpu/drm/drm_simple_kms_helper.c |  46 +-
 drivers/gpu/drm/drm_writeback.c         | 136 +++--
 drivers/gpu/drm/vc4/vc4_bo.c            |  33 +-
 drivers/gpu/drm/vc4/vc4_crtc.c          |  69 ++-
 drivers/gpu/drm/vc4/vc4_debugfs.c       |  71 ++-
 drivers/gpu/drm/vc4/vc4_dpi.c           | 131 ++---
 drivers/gpu/drm/vc4/vc4_drv.c           |  18 +-
 drivers/gpu/drm/vc4/vc4_drv.h           |  47 +-
 drivers/gpu/drm/vc4/vc4_dsi.c           | 120 +++--
 drivers/gpu/drm/vc4/vc4_gem.c           |  10 +-
 drivers/gpu/drm/vc4/vc4_hdmi.c          | 637 +++++++++++++++++-------
 drivers/gpu/drm/vc4/vc4_hdmi.h          |   3 +-
 drivers/gpu/drm/vc4/vc4_hvs.c           | 145 +++++-
 drivers/gpu/drm/vc4/vc4_irq.c           |   2 +-
 drivers/gpu/drm/vc4/vc4_perfmon.c       |   1 +
 drivers/gpu/drm/vc4/vc4_plane.c         |  36 +-
 drivers/gpu/drm/vc4/vc4_txp.c           |  69 +--
 drivers/gpu/drm/vc4/vc4_v3d.c           |  65 ++-
 drivers/gpu/drm/vc4/vc4_vec.c           | 216 ++++----
 include/drm/drm_bridge.h                |   4 +
 include/drm/drm_connector.h             |   9 +
 include/drm/drm_crtc.h                  |   6 +
 include/drm/drm_encoder.h               |   5 +
 include/drm/drm_simple_kms_helper.h     |   3 +
 include/drm/drm_writeback.h             |   5 +
 30 files changed, 1621 insertions(+), 645 deletions(-)

-- 
2.36.1

Reply via email to