Skip to content

Commit 1e5d41b

Browse files
committed
Merge tag 'drm-fixes-2025-10-11' of https://gitlab.freedesktop.org/drm/kernel
Pull drm fixes from Dave Airlie: "Some fixes leftover from our fixes branch, just nouveau and vmwgfx: nouveau: - Return errno code from TTM move helper vmwgfx: - Fix null-ptr access in cursor code - Fix UAF in validation - Use correct iterator in validation" * tag 'drm-fixes-2025-10-11' of https://gitlab.freedesktop.org/drm/kernel: drm/nouveau: fix bad ret code in nouveau_bo_move_prep drm/vmwgfx: Fix copy-paste typo in validation drm/vmwgfx: Fix Use-after-free in validation drm/vmwgfx: Fix a null-ptr access in the cursor snooper
2 parents f76b168 + 5ca5f00 commit 1e5d41b

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

drivers/gpu/drm/nouveau/nouveau_bo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ nouveau_bo_move_prep(struct nouveau_drm *drm, struct ttm_buffer_object *bo,
929929
nvif_vmm_put(vmm, &old_mem->vma[1]);
930930
nvif_vmm_put(vmm, &old_mem->vma[0]);
931931
}
932-
return 0;
932+
return ret;
933933
}
934934

935935
static int

drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,7 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv,
14971497
SVGA3dCmdHeader *header)
14981498
{
14991499
struct vmw_bo *vmw_bo = NULL;
1500+
struct vmw_resource *res;
15001501
struct vmw_surface *srf = NULL;
15011502
VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdSurfaceDMA);
15021503
int ret;
@@ -1532,18 +1533,24 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv,
15321533

15331534
dirty = (cmd->body.transfer == SVGA3D_WRITE_HOST_VRAM) ?
15341535
VMW_RES_DIRTY_SET : 0;
1535-
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface,
1536-
dirty, user_surface_converter,
1537-
&cmd->body.host.sid, NULL);
1536+
ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, dirty,
1537+
user_surface_converter, &cmd->body.host.sid,
1538+
NULL);
15381539
if (unlikely(ret != 0)) {
15391540
if (unlikely(ret != -ERESTARTSYS))
15401541
VMW_DEBUG_USER("could not find surface for DMA.\n");
15411542
return ret;
15421543
}
15431544

1544-
srf = vmw_res_to_srf(sw_context->res_cache[vmw_res_surface].res);
1545+
res = sw_context->res_cache[vmw_res_surface].res;
1546+
if (!res) {
1547+
VMW_DEBUG_USER("Invalid DMA surface.\n");
1548+
return -EINVAL;
1549+
}
15451550

1546-
vmw_kms_cursor_snoop(srf, sw_context->fp->tfile, &vmw_bo->tbo, header);
1551+
srf = vmw_res_to_srf(res);
1552+
vmw_kms_cursor_snoop(srf, sw_context->fp->tfile, &vmw_bo->tbo,
1553+
header);
15471554

15481555
return 0;
15491556
}

drivers/gpu/drm/vmwgfx/vmwgfx_validation.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,10 @@ int vmw_validation_add_resource(struct vmw_validation_context *ctx,
308308
hash_add_rcu(ctx->sw_context->res_ht, &node->hash.head, node->hash.key);
309309
}
310310
node->res = vmw_resource_reference_unless_doomed(res);
311-
if (!node->res)
311+
if (!node->res) {
312+
hash_del_rcu(&node->hash.head);
312313
return -ESRCH;
314+
}
313315

314316
node->first_usage = 1;
315317
if (!res->dev_priv->has_mob) {
@@ -636,7 +638,7 @@ void vmw_validation_drop_ht(struct vmw_validation_context *ctx)
636638
hash_del_rcu(&val->hash.head);
637639

638640
list_for_each_entry(val, &ctx->resource_ctx_list, head)
639-
hash_del_rcu(&entry->hash.head);
641+
hash_del_rcu(&val->hash.head);
640642

641643
ctx->sw_context = NULL;
642644
}

0 commit comments

Comments
 (0)