diff options
author | Jerome Glisse <jglisse@redhat.com> | 2012-07-02 12:40:54 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-07-03 06:17:09 -0400 |
commit | 1ef5325b238676c7a16bcd374250b07e77682736 (patch) | |
tree | 085db47a47284f08954b1161c19b75c9ac14f9c9 /drivers/gpu/drm/radeon | |
parent | c21b328ea8c7c71cd2daf50557db440bbaa7ef55 (diff) |
drm/radeon: fix rare segfault
In gem idle/busy ioctl the radeon object was derefenced after
drm_gem_object_unreference_unlocked which in case the object
have been destroyed lead to use of a possibly free pointer with
possibly wrong data.
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_gem.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index f28bd4b7ef98..21ec9f5653ce 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -292,6 +292,7 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
292 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | 292 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, |
293 | struct drm_file *filp) | 293 | struct drm_file *filp) |
294 | { | 294 | { |
295 | struct radeon_device *rdev = dev->dev_private; | ||
295 | struct drm_radeon_gem_busy *args = data; | 296 | struct drm_radeon_gem_busy *args = data; |
296 | struct drm_gem_object *gobj; | 297 | struct drm_gem_object *gobj; |
297 | struct radeon_bo *robj; | 298 | struct radeon_bo *robj; |
@@ -317,13 +318,14 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
317 | break; | 318 | break; |
318 | } | 319 | } |
319 | drm_gem_object_unreference_unlocked(gobj); | 320 | drm_gem_object_unreference_unlocked(gobj); |
320 | r = radeon_gem_handle_lockup(robj->rdev, r); | 321 | r = radeon_gem_handle_lockup(rdev, r); |
321 | return r; | 322 | return r; |
322 | } | 323 | } |
323 | 324 | ||
324 | int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | 325 | int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, |
325 | struct drm_file *filp) | 326 | struct drm_file *filp) |
326 | { | 327 | { |
328 | struct radeon_device *rdev = dev->dev_private; | ||
327 | struct drm_radeon_gem_wait_idle *args = data; | 329 | struct drm_radeon_gem_wait_idle *args = data; |
328 | struct drm_gem_object *gobj; | 330 | struct drm_gem_object *gobj; |
329 | struct radeon_bo *robj; | 331 | struct radeon_bo *robj; |
@@ -336,10 +338,10 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | |||
336 | robj = gem_to_radeon_bo(gobj); | 338 | robj = gem_to_radeon_bo(gobj); |
337 | r = radeon_bo_wait(robj, NULL, false); | 339 | r = radeon_bo_wait(robj, NULL, false); |
338 | /* callback hw specific functions if any */ | 340 | /* callback hw specific functions if any */ |
339 | if (robj->rdev->asic->ioctl_wait_idle) | 341 | if (rdev->asic->ioctl_wait_idle) |
340 | robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj); | 342 | robj->rdev->asic->ioctl_wait_idle(rdev, robj); |
341 | drm_gem_object_unreference_unlocked(gobj); | 343 | drm_gem_object_unreference_unlocked(gobj); |
342 | r = radeon_gem_handle_lockup(robj->rdev, r); | 344 | r = radeon_gem_handle_lockup(rdev, r); |
343 | return r; | 345 | return r; |
344 | } | 346 | } |
345 | 347 | ||