[an error occurred while processing this directive]
|
|
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240321235818.125118-1-lokeshgidra@google.com>
Date: Thu, 21 Mar 2024 16:58:18 -0700
From: Lokesh Gidra <lokeshgidra@...gle.com>
To: akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, surenb@...gle.com,
kernel-team@...roid.com, aarcange@...hat.com, peterx@...hat.com,
david@...hat.com, axelrasmussen@...gle.com, bgeffon@...gle.com,
jannh@...gle.com, kaleshsingh@...gle.com, ngeoffray@...gle.com,
rppt@...nel.org, hdanton@...a.com, Lokesh Gidra <lokeshgidra@...gle.com>,
syzbot+49056626fe41e01f2ba7@...kaller.appspotmail.com
Subject: [PATCH] userfaultfd: fix deadlock warning when locking src and dst VMAs
Use down_read_nested() to avoid the warning.
Reported-by: syzbot+49056626fe41e01f2ba7@...kaller.appspotmail.com
Signed-off-by: Lokesh Gidra <lokeshgidra@...gle.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
Powered by blists - more mailing lists