diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-09-27 16:28:30 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-09-27 19:14:34 -0400 |
commit | 31dfbc93923c0aaa0440b809f80ff2830c6a531a (patch) | |
tree | 9527de1c84f266ea23d6009c454d7cf1d1769889 /drivers/gpu/drm/drm_gem.c | |
parent | 73758a5d51280ca0613b8380fc07351f4d64f9c8 (diff) |
drm: Prune GEM vma entries
Hook the GEM vm open/close ops into the generic drm vm open/close so
that the private vma entries are created and destroy appropriately.
Fixes the leak of the drm_vma_entries during the lifetime of the filp.
Reported-by: Matt Mackall <mpm@selenic.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_gem.c')
-rw-r--r-- | drivers/gpu/drm/drm_gem.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index bf92d07510df..6fe2cd298c12 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -528,6 +528,10 @@ void drm_gem_vm_open(struct vm_area_struct *vma) | |||
528 | struct drm_gem_object *obj = vma->vm_private_data; | 528 | struct drm_gem_object *obj = vma->vm_private_data; |
529 | 529 | ||
530 | drm_gem_object_reference(obj); | 530 | drm_gem_object_reference(obj); |
531 | |||
532 | mutex_lock(&obj->dev->struct_mutex); | ||
533 | drm_vm_open_locked(vma); | ||
534 | mutex_unlock(&obj->dev->struct_mutex); | ||
531 | } | 535 | } |
532 | EXPORT_SYMBOL(drm_gem_vm_open); | 536 | EXPORT_SYMBOL(drm_gem_vm_open); |
533 | 537 | ||
@@ -535,7 +539,10 @@ void drm_gem_vm_close(struct vm_area_struct *vma) | |||
535 | { | 539 | { |
536 | struct drm_gem_object *obj = vma->vm_private_data; | 540 | struct drm_gem_object *obj = vma->vm_private_data; |
537 | 541 | ||
538 | drm_gem_object_unreference_unlocked(obj); | 542 | mutex_lock(&obj->dev->struct_mutex); |
543 | drm_vm_close_locked(vma); | ||
544 | drm_gem_object_unreference(obj); | ||
545 | mutex_unlock(&obj->dev->struct_mutex); | ||
539 | } | 546 | } |
540 | EXPORT_SYMBOL(drm_gem_vm_close); | 547 | EXPORT_SYMBOL(drm_gem_vm_close); |
541 | 548 | ||