Skip to content

Commit 30af24f

Browse files
SENSEIIIIIakpm00
authored andcommitted
userfaultfd: fix deadlock warning when locking src and dst VMAs
Use down_read_nested() to avoid the warning. Link: https://lkml.kernel.org/r/[email protected] Fixes: 867a43a ("userfaultfd: use per-vma locks in userfaultfd operations") Reported-by: [email protected] Signed-off-by: Lokesh Gidra <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Axel Rasmussen <[email protected]> Cc: Brian Geffon <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Hillf Danton <[email protected]> Cc: Jann Horn <[email protected]> [Bug #2] Cc: Kalesh Singh <[email protected]> Cc: Lokesh Gidra <[email protected]> Cc: Mike Rapoport (IBM) <[email protected]> Cc: Nicolas Geoffray <[email protected]> Cc: Peter Xu <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 0a69b6b commit 30af24f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mm/userfaultfd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,8 @@ static int uffd_move_lock(struct mm_struct *mm,
14441444
*/
14451445
down_read(&(*dst_vmap)->vm_lock->lock);
14461446
if (*dst_vmap != *src_vmap)
1447-
down_read(&(*src_vmap)->vm_lock->lock);
1447+
down_read_nested(&(*src_vmap)->vm_lock->lock,
1448+
SINGLE_DEPTH_NESTING);
14481449
}
14491450
mmap_read_unlock(mm);
14501451
return err;

0 commit comments

Comments
 (0)