]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/vmwgfx: Return the correct value in vmw_translate_ptr functions
authorIan Forbes <ian.forbes@broadcom.com>
Tue, 13 Jan 2026 17:53:57 +0000 (11:53 -0600)
committerZack Rusin <zack.rusin@broadcom.com>
Thu, 5 Feb 2026 17:44:23 +0000 (12:44 -0500)
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: a309c7194e8a ("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
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c

index 3057f8baa7d25bbf94b7a93d7ea086b89ab9e84e..e1f18020170ab84b77170b8075892e035303916b 100644 (file)
@@ -1143,7 +1143,7 @@ static int vmw_translate_mob_ptr(struct vmw_private *dev_priv,
        ret = vmw_user_bo_lookup(sw_context->filp, handle, &vmw_bo);
        if (ret != 0) {
                drm_dbg(&dev_priv->drm, "Could not find or use MOB buffer.\n");
-               return PTR_ERR(vmw_bo);
+               return ret;
        }
        vmw_bo_placement_set(vmw_bo, VMW_BO_DOMAIN_MOB, VMW_BO_DOMAIN_MOB);
        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,
        ret = vmw_user_bo_lookup(sw_context->filp, handle, &vmw_bo);
        if (ret != 0) {
                drm_dbg(&dev_priv->drm, "Could not find or use GMR region.\n");
-               return PTR_ERR(vmw_bo);
+               return ret;
        }
        vmw_bo_placement_set(vmw_bo, VMW_BO_DOMAIN_GMR | VMW_BO_DOMAIN_VRAM,
                             VMW_BO_DOMAIN_GMR | VMW_BO_DOMAIN_VRAM);