aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiviu Dudau <[email protected]>2024-11-06 18:58:06 +0000
committerSteven Price <[email protected]>2024-11-07 15:23:54 +0000
commit444fa5b100e5c90550d6bccfe4476efb0391b3ca (patch)
tree16ade418aeb6641f46702d81ecee327d43cda204
parent052ef642bd6c108a24f375f9ad174b97b425a50b (diff)
drm/panthor: Lock XArray when getting entries for the VM
Similar to commit cac075706f29 ("drm/panthor: Fix race when converting group handle to group object") we need to use the XArray's internal locking when retrieving a vm pointer from there. v2: Removed part of the patch that was trying to protect fetching the heap pointer from XArray, as that operation is protected by the @pool->lock. Fixes: 647810ec2476 ("drm/panthor: Add the MMU/VM logical block") Reported-by: Jann Horn <[email protected]> Cc: [email protected] Signed-off-by: Liviu Dudau <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Reviewed-by: Steven Price <[email protected]> Signed-off-by: Steven Price <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r--drivers/gpu/drm/panthor/panthor_mmu.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
index 5d5e25b1be95..7db2edb3374c 100644
--- a/drivers/gpu/drm/panthor/panthor_mmu.c
+++ b/drivers/gpu/drm/panthor/panthor_mmu.c
@@ -1580,7 +1580,9 @@ panthor_vm_pool_get_vm(struct panthor_vm_pool *pool, u32 handle)
{
struct panthor_vm *vm;
+ xa_lock(&pool->xa);
vm = panthor_vm_get(xa_load(&pool->xa, handle));
+ xa_unlock(&pool->xa);
return vm;
}