Skip to content

Commit

Permalink
drm/radeon/kms: take vram mutex pointer before derefing object.
Browse files Browse the repository at this point in the history
since derefing the object might free it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Dave Airlie committed May 18, 2010
1 parent 539d241 commit f4b7fb9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/gpu/drm/radeon/radeon_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,15 @@ void radeon_bo_kunmap(struct radeon_bo *bo)
void radeon_bo_unref(struct radeon_bo **bo)
{
struct ttm_buffer_object *tbo;
struct radeon_device *rdev;

if ((*bo) == NULL)
return;
rdev = (*bo)->rdev;
tbo = &((*bo)->tbo);
mutex_lock(&(*bo)->rdev->vram_mutex);
mutex_lock(&rdev->vram_mutex);
ttm_bo_unref(&tbo);
mutex_unlock(&(*bo)->rdev->vram_mutex);
mutex_unlock(&rdev->vram_mutex);
if (tbo == NULL)
*bo = NULL;
}
Expand Down

0 comments on commit f4b7fb9

Please sign in to comment.