drm/radeon: fix user ptr race condition
diff mbox

Message ID 1436882310-9958-1-git-send-email-deathsimple@vodafone.de
State New
Headers show

Commit Message

Christian König July 14, 2015, 1:58 p.m. UTC
From: Christian König <christian.koenig@amd.com>

Port of amdgpu patch 9298e52f8b51d1e4acd68f502832f3a97f8cf892.

Signed-off-by: Christian König <christian.koenig@amd.com>
CC: stable@vger.kernel.org
---
 drivers/gpu/drm/radeon/radeon_gem.c    | 1 +
 drivers/gpu/drm/radeon/radeon_object.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

Comments

Alex Deucher July 14, 2015, 2:26 p.m. UTC | #1
On Tue, Jul 14, 2015 at 9:58 AM, Christian König
<deathsimple@vodafone.de> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> Port of amdgpu patch 9298e52f8b51d1e4acd68f502832f3a97f8cf892.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> CC: stable@vger.kernel.org
> ---

Applied.  thanks!

Alex

>  drivers/gpu/drm/radeon/radeon_gem.c    | 1 +
>  drivers/gpu/drm/radeon/radeon_object.c | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
> index 013ec71..3dcc573 100644
> --- a/drivers/gpu/drm/radeon/radeon_gem.c
> +++ b/drivers/gpu/drm/radeon/radeon_gem.c
> @@ -36,6 +36,7 @@ void radeon_gem_object_free(struct drm_gem_object *gobj)
>         if (robj) {
>                 if (robj->gem_base.import_attach)
>                         drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
> +               radeon_mn_unregister(robj);
>                 radeon_bo_unref(&robj);
>         }
>  }
> diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
> index 318165d..6763627 100644
> --- a/drivers/gpu/drm/radeon/radeon_object.c
> +++ b/drivers/gpu/drm/radeon/radeon_object.c
> @@ -75,7 +75,6 @@ static void radeon_ttm_bo_destroy(struct ttm_buffer_object *tbo)
>         bo = container_of(tbo, struct radeon_bo, tbo);
>
>         radeon_update_memory_usage(bo, bo->tbo.mem.mem_type, -1);
> -       radeon_mn_unregister(bo);
>
>         mutex_lock(&bo->rdev->gem.mutex);
>         list_del_init(&bo->list);
> --
> 1.9.1
>

Patch
diff mbox

diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 013ec71..3dcc573 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -36,6 +36,7 @@  void radeon_gem_object_free(struct drm_gem_object *gobj)
 	if (robj) {
 		if (robj->gem_base.import_attach)
 			drm_prime_gem_destroy(&robj->gem_base, robj->tbo.sg);
+		radeon_mn_unregister(robj);
 		radeon_bo_unref(&robj);
 	}
 }
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 318165d..6763627 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -75,7 +75,6 @@  static void radeon_ttm_bo_destroy(struct ttm_buffer_object *tbo)
 	bo = container_of(tbo, struct radeon_bo, tbo);
 
 	radeon_update_memory_usage(bo, bo->tbo.mem.mem_type, -1);
-	radeon_mn_unregister(bo);
 
 	mutex_lock(&bo->rdev->gem.mutex);
 	list_del_init(&bo->list);