diff options
author | Thierry Reding <thierry.reding@gmail.com> | 2013-08-28 06:04:14 -0400 |
---|---|---|
committer | Dave Airlie <airlied@gmail.com> | 2013-08-29 19:11:59 -0400 |
commit | 9c784855067a8d10cef6088b14a58083e3918fdc (patch) | |
tree | 2eb35545b4a532f9f81cbcaa720b8841871862d5 | |
parent | 807ac202f20aa0a5e991851931dbfa4e4fac558d (diff) |
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: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@gmail.com>
-rw-r--r-- | drivers/gpu/drm/drm_gem.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index b2d59b2d3acc..49293bdc972a 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -297,7 +297,8 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle) | |||
297 | idr_remove(&filp->object_idr, handle); | 297 | idr_remove(&filp->object_idr, handle); |
298 | spin_unlock(&filp->table_lock); | 298 | spin_unlock(&filp->table_lock); |
299 | 299 | ||
300 | drm_gem_remove_prime_handles(obj, filp); | 300 | if (drm_core_check_feature(dev, DRIVER_PRIME)) |
301 | drm_gem_remove_prime_handles(obj, filp); | ||
301 | drm_vma_node_revoke(&obj->vma_node, filp->filp); | 302 | drm_vma_node_revoke(&obj->vma_node, filp->filp); |
302 | 303 | ||
303 | if (dev->driver->gem_close_object) | 304 | if (dev->driver->gem_close_object) |
@@ -706,7 +707,8 @@ drm_gem_object_release_handle(int id, void *ptr, void *data) | |||
706 | struct drm_gem_object *obj = ptr; | 707 | struct drm_gem_object *obj = ptr; |
707 | struct drm_device *dev = obj->dev; | 708 | struct drm_device *dev = obj->dev; |
708 | 709 | ||
709 | drm_gem_remove_prime_handles(obj, file_priv); | 710 | if (drm_core_check_feature(dev, DRIVER_PRIME)) |
711 | drm_gem_remove_prime_handles(obj, file_priv); | ||
710 | drm_vma_node_revoke(&obj->vma_node, file_priv->filp); | 712 | drm_vma_node_revoke(&obj->vma_node, file_priv->filp); |
711 | 713 | ||
712 | if (dev->driver->gem_close_object) | 714 | if (dev->driver->gem_close_object) |