]> git.baikalelectronics.ru Git - kernel.git/commit
drm/vc4: vec: Protect device resources after removal
authorMaxime Ripard <maxime@cerno.tech>
Mon, 11 Jul 2022 17:39:30 +0000 (19:39 +0200)
committerMaxime Ripard <maxime@cerno.tech>
Wed, 13 Jul 2022 08:46:12 +0000 (10:46 +0200)
commit9cbad3e6ddebe6e8d8f986be528001e24f50979e
tree1d78a07227dc8b7669aaa3e6fa62c6fe3ef318d2
parent50f4b61a8e423d7d13009b175a9cc029ee087271
drm/vc4: vec: 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 VEC driver.

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