[PATCH] drm/xe: Fix access_ok check in user_fence_create
Singh, Apoorva
apoorva.singh at intel.com
Tue Aug 6 14:38:47 UTC 2024
> -----Original Message-----
> From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of Nirmoy
> Das
> Sent: Tuesday, August 6, 2024 4:37 PM
> To: intel-xe at lists.freedesktop.org
> Cc: Das, Nirmoy <nirmoy.das at intel.com>; lkp <lkp at intel.com>; Auld,
> Matthew <matthew.auld at intel.com>; Brost, Matthew
> <matthew.brost at intel.com>
> Subject: [PATCH] drm/xe: Fix access_ok check in user_fence_create
>
> Check size of the data not size of the pointer.
>
> Reported-by: kernel test robot <lkp at intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202407300421.IBkAja96-
> lkp at intel.com/
> Fixes: 0fde907da2d5 ("drm/xe: Validate user fence during creation")
> Cc: Matthew Auld <matthew.auld at intel.com>
> Cc: Matthew Brost <matthew.brost at intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
> ---
> drivers/gpu/drm/xe/xe_sync.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_sync.c b/drivers/gpu/drm/xe/xe_sync.c
> index 3aa6270e5dd7..ca826aeb41ea 100644
> --- a/drivers/gpu/drm/xe/xe_sync.c
> +++ b/drivers/gpu/drm/xe/xe_sync.c
> @@ -55,7 +55,7 @@ static struct xe_user_fence *user_fence_create(struct
> xe_device *xe, u64 addr,
> struct xe_user_fence *ufence;
> u64 __user *ptr = u64_to_user_ptr(addr);
>
> - if (!access_ok(ptr, sizeof(ptr)))
> + if (!access_ok(ptr, sizeof(*ptr)))
> return ERR_PTR(-EFAULT);
>
> ufence = kmalloc(sizeof(*ufence), GFP_KERNEL);
> --
> 2.42.0
Reviewed-by: Apoorva Singh <apoorva.singh at intel.com>
More information about the Intel-xe
mailing list