Skip to content

Commit 9c1813b

Browse files
nirmoylucasdemarchi
authored andcommitted
drm/xe/ufence: Prefetch ufence addr to catch bogus address
access_ok() only checks for addr overflow so also try to read the addr to catch invalid addr sent from userspace. Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/1630 Cc: Francois Dugast <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Matthew Auld <[email protected]> Cc: Matthew Brost <[email protected]> Reviewed-by: Matthew Brost <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Nirmoy Das <[email protected]> (cherry picked from commit 9408c45) Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 69418db commit 9c1813b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/xe/xe_sync.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ static struct xe_user_fence *user_fence_create(struct xe_device *xe, u64 addr,
5454
{
5555
struct xe_user_fence *ufence;
5656
u64 __user *ptr = u64_to_user_ptr(addr);
57+
u64 __maybe_unused prefetch_val;
5758

58-
if (!access_ok(ptr, sizeof(*ptr)))
59+
if (get_user(prefetch_val, ptr))
5960
return ERR_PTR(-EFAULT);
6061

6162
ufence = kzalloc(sizeof(*ufence), GFP_KERNEL);

0 commit comments

Comments
 (0)