linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] userfaultfd: fix deadlock warning when locking src and dst VMAs
@ 2024-03-21 23:58 Lokesh Gidra
  2024-03-22  0:47 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Lokesh Gidra @ 2024-03-21 23:58 UTC (permalink / raw)
  To: akpm
  Cc: linux-mm, linux-kernel, surenb, kernel-team, aarcange, peterx,
	david, axelrasmussen, bgeffon, jannh, kaleshsingh, ngeoffray,
	rppt, hdanton, Lokesh Gidra, syzbot+49056626fe41e01f2ba7

Use down_read_nested() to avoid the warning.

Reported-by: syzbot+49056626fe41e01f2ba7@syzkaller.appspotmail.com
Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
---
 mm/userfaultfd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c
index 712160cd41ec..3c3539c573e7 100644
--- a/mm/userfaultfd.c
+++ b/mm/userfaultfd.c
@@ -1444,7 +1444,8 @@ static int uffd_move_lock(struct mm_struct *mm,
 		 */
 		down_read(&(*dst_vmap)->vm_lock->lock);
 		if (*dst_vmap != *src_vmap)
-			down_read(&(*src_vmap)->vm_lock->lock);
+			down_read_nested(&(*src_vmap)->vm_lock->lock,
+					 SINGLE_DEPTH_NESTING);
 	}
 	mmap_read_unlock(mm);
 	return err;
-- 
2.44.0.396.g6e790dbe36-goog



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-22  0:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-21 23:58 [PATCH] userfaultfd: fix deadlock warning when locking src and dst VMAs Lokesh Gidra
2024-03-22  0:47 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox