Skip to content

Commit dfe1323

Browse files
en4bzzackr
authored andcommitted
drm/vmwgfx: Fix Use-after-free in validation
Nodes stored in the validation duplicates hashtable come from an arena allocator that is cleared at the end of vmw_execbuf_process. All nodes are expected to be cleared in vmw_validation_drop_ht but this node escaped because its resource was destroyed prematurely. Fixes: 64ad2ab ("drm/vmwgfx: Adapt validation code for reference-free lookups") Reported-by: Kuzey Arda Bulut <[email protected]> Signed-off-by: Ian Forbes <[email protected]> Reviewed-by: Zack Rusin <[email protected]> Signed-off-by: Zack Rusin <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5ac2c02 commit dfe1323

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/vmwgfx/vmwgfx_validation.c

Lines changed: 3 additions & 1 deletion
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) {

0 commit comments

Comments
 (0)