[PATCH drm-misc-next 2/3] drm/vc4: plane: protect device resources after removal

Maxime Ripard maxime at cerno.tech
Fri Aug 19 07:26:14 UTC 2022


Hi,

On Fri, Aug 19, 2022 at 02:29:04AM +0200, Danilo Krummrich wrote:
> (Hardware) resources which are bound to the driver and device lifecycle
> must not be accessed after the device and driver are unbound.
> 
> However, the DRM device isn't freed as long as the last user closed it,
> hence userspace can still call into the driver.
> 
> Therefore protect the critical sections which are accessing those
> resources with drm_dev_enter() and drm_dev_exit().

Ah good catch, thanks

> Fixes: 9872c7a31921 ("drm/vc4: plane: Switch to drmm_universal_plane_alloc()")
> Signed-off-by: Danilo Krummrich <dakr at redhat.com>
> ---
>  drivers/gpu/drm/vc4/vc4_drv.h   |  1 +
>  drivers/gpu/drm/vc4/vc4_plane.c | 25 +++++++++++++++++++++++++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
> index 418a8242691f..80da9a9337cc 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.h
> +++ b/drivers/gpu/drm/vc4/vc4_drv.h
> @@ -341,6 +341,7 @@ struct vc4_hvs {
>  
>  struct vc4_plane {
>  	struct drm_plane base;
> +	struct drm_device *dev;

That pointer already exists in struct drm_plane

Looks good otherwise

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20220819/0d55d35d/attachment.sig>


More information about the dri-devel mailing list