Skip to content

Commit 5023ca8

Browse files
en4bzzackr
authored andcommitted
drm/vmwgfx: Return the correct value in vmw_translate_ptr functions
Before the referenced fixes these functions used a lookup function that returned a pointer. This was changed to another lookup function that returned an error code with the pointer becoming an out parameter. The error path when the lookup failed was not changed to reflect this change and the code continued to return the PTR_ERR of the now uninitialized pointer. This could cause the vmw_translate_ptr functions to return success when they actually failed causing further uninitialized and OOB accesses. Reported-by: Kuzey Arda Bulut <kuzeyardabulut@gmail.com> Fixes: a309c71 ("drm/vmwgfx: Remove rcu locks from user resources") Signed-off-by: Ian Forbes <ian.forbes@broadcom.com> Reviewed-by: Zack Rusin <zack.rusin@broadcom.com> Signed-off-by: Zack Rusin <zack.rusin@broadcom.com> Link: https://patch.msgid.link/20260113175357.129285-1-ian.forbes@broadcom.com
1 parent 922f9de commit 5023ca8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ static int vmw_translate_mob_ptr(struct vmw_private *dev_priv,
11431143
ret = vmw_user_bo_lookup(sw_context->filp, handle, &vmw_bo);
11441144
if (ret != 0) {
11451145
drm_dbg(&dev_priv->drm, "Could not find or use MOB buffer.\n");
1146-
return PTR_ERR(vmw_bo);
1146+
return ret;
11471147
}
11481148
vmw_bo_placement_set(vmw_bo, VMW_BO_DOMAIN_MOB, VMW_BO_DOMAIN_MOB);
11491149
ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo);
@@ -1199,7 +1199,7 @@ static int vmw_translate_guest_ptr(struct vmw_private *dev_priv,
11991199
ret = vmw_user_bo_lookup(sw_context->filp, handle, &vmw_bo);
12001200
if (ret != 0) {
12011201
drm_dbg(&dev_priv->drm, "Could not find or use GMR region.\n");
1202-
return PTR_ERR(vmw_bo);
1202+
return ret;
12031203
}
12041204
vmw_bo_placement_set(vmw_bo, VMW_BO_DOMAIN_GMR | VMW_BO_DOMAIN_VRAM,
12051205
VMW_BO_DOMAIN_GMR | VMW_BO_DOMAIN_VRAM);

0 commit comments

Comments
 (0)