Skip to content

Commit 982b173

Browse files
Min Lialexdeucher
authored andcommitted
drm/radeon: fix race condition UAF in radeon_gem_set_domain_ioctl
Userspace can race to free the gobj(robj converted from), robj should not be accessed again after drm_gem_object_put, otherwith it will result in use-after-free. Reviewed-by: Christian König <[email protected]> Signed-off-by: Min Li <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 73c12de commit 982b173

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/gpu/drm/radeon/radeon_gem.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data,
459459
struct radeon_device *rdev = dev->dev_private;
460460
struct drm_radeon_gem_set_domain *args = data;
461461
struct drm_gem_object *gobj;
462-
struct radeon_bo *robj;
463462
int r;
464463

465464
/* for now if someone requests domain CPU -
@@ -472,13 +471,12 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data,
472471
up_read(&rdev->exclusive_lock);
473472
return -ENOENT;
474473
}
475-
robj = gem_to_radeon_bo(gobj);
476474

477475
r = radeon_gem_set_domain(gobj, args->read_domains, args->write_domain);
478476

479477
drm_gem_object_put(gobj);
480478
up_read(&rdev->exclusive_lock);
481-
r = radeon_gem_handle_lockup(robj->rdev, r);
479+
r = radeon_gem_handle_lockup(rdev, r);
482480
return r;
483481
}
484482

0 commit comments

Comments
 (0)