[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e337dec6-0b0e-7e53-e38d-ae1791b98418@amd.com>
Date: Mon, 5 Jun 2023 10:12:52 +0200
From: Christian König <christian.koenig@....com>
To: Min Li <lm0963hack@...il.com>, alexander.deucher@....com
Cc: Xinhui.Pan@....com, airlied@...il.com, daniel@...ll.ch,
sumit.semwal@...aro.org, amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
linux-media@...r.kernel.org, linaro-mm-sig@...ts.linaro.org
Subject: Re: [PATCH v2] drm/radeon: fix race condition UAF in
radeon_gem_set_domain_ioctl
Am 03.06.23 um 09:43 schrieb Min Li:
> 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.
>
> Signed-off-by: Min Li <lm0963hack@...il.com>
Reviewed-by: Christian König <christian.koenig@....com>
> ---
> Changes in v2:
> - Remove unused robj, avoid compile complain
>
> drivers/gpu/drm/radeon/radeon_gem.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
> index bdc5af23f005..d3f5ddbc1704 100644
> --- a/drivers/gpu/drm/radeon/radeon_gem.c
> +++ b/drivers/gpu/drm/radeon/radeon_gem.c
> @@ -459,7 +459,6 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data,
> struct radeon_device *rdev = dev->dev_private;
> struct drm_radeon_gem_set_domain *args = data;
> struct drm_gem_object *gobj;
> - struct radeon_bo *robj;
> int r;
>
> /* for now if someone requests domain CPU -
> @@ -472,13 +471,12 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data,
> up_read(&rdev->exclusive_lock);
> return -ENOENT;
> }
> - robj = gem_to_radeon_bo(gobj);
>
> r = radeon_gem_set_domain(gobj, args->read_domains, args->write_domain);
>
> drm_gem_object_put(gobj);
> up_read(&rdev->exclusive_lock);
> - r = radeon_gem_handle_lockup(robj->rdev, r);
> + r = radeon_gem_handle_lockup(rdev, r);
> return r;
> }
>
Powered by blists - more mailing lists