]> git.baikalelectronics.ru Git - kernel.git/commit
drm/vc4: hdmi: Protect device resources after removal
authorMaxime Ripard <maxime@cerno.tech>
Mon, 11 Jul 2022 17:39:17 +0000 (19:39 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Wed, 13 Jul 2022 08:46:10 +0000 (10:46 +0200)
commit8250f13eb1d00c493564b918029e2681f2193068
treeac3a2f265e04eb1aa13fc09e823dca16d0237357
parentea9958ce18eab34a6e01406d7f21e9e981d824ce
drm/vc4: hdmi: Protect device resources after removal

Whenever the device and driver are unbound, the main device and all the
subdevices will be removed by calling their unbind() method.

However, the DRM device itself will only be freed when the last user will
have closed it.

It means that there is a time window where the device and its resources
aren't there anymore, but the userspace can still call into our driver.

Fortunately, the DRM framework provides the drm_dev_enter() and
drm_dev_exit() functions to make sure our underlying device is still there
for the section protected by those calls. Let's add them to the HDMI driver.

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220711173939.1132294-48-maxime@cerno.tech
drivers/gpu/drm/vc4/vc4_hdmi.c