]> Git Repo - linux.git/commitdiff
drm/panthor: Lock XArray when getting entries for the VM
authorLiviu Dudau <[email protected]>
Wed, 6 Nov 2024 18:58:06 +0000 (18:58 +0000)
committerSteven Price <[email protected]>
Thu, 7 Nov 2024 15:23:54 +0000 (15:23 +0000)
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]
drivers/gpu/drm/panthor/panthor_mmu.c

index 5d5e25b1be95cb618460b18f41710855a475f51e..7db2edb3374c9df4a3e3098f8178a84200e81818 100644 (file)
@@ -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;
 }
This page took 0.0581660000000001 seconds and 4 git commands to generate.