Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c784855 authored by Thierry Reding's avatar Thierry Reding Committed by Dave Airlie
Browse files

drm/prime: Remove PRIME handles only if supported



Drivers that don't support PRIME will not have initialized the PRIME
specific private component of struct drm_file. If called for such
drivers, the drm_gem_remove_prime_handles() function will crash. Fix
it by checking for PRIME support prior to removing the PRIME handles.

Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarDave Airlie <airlied@gmail.com>
parent 807ac202
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -297,6 +297,7 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle)
	idr_remove(&filp->object_idr, handle);
	spin_unlock(&filp->table_lock);

	if (drm_core_check_feature(dev, DRIVER_PRIME))
		drm_gem_remove_prime_handles(obj, filp);
	drm_vma_node_revoke(&obj->vma_node, filp->filp);

@@ -706,6 +707,7 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)
	struct drm_gem_object *obj = ptr;
	struct drm_device *dev = obj->dev;

	if (drm_core_check_feature(dev, DRIVER_PRIME))
		drm_gem_remove_prime_handles(obj, file_priv);
	drm_vma_node_revoke(&obj->vma_node, file_priv->filp);