]> git.dujemihanovic.xyz Git - linux.git/commit
userfaultfd: fix mmap_changing checking in mfill_atomic_hugetlb
authorLokesh Gidra <lokeshgidra@google.com>
Wed, 17 Jan 2024 22:37:29 +0000 (14:37 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 26 Jan 2024 07:52:21 +0000 (23:52 -0800)
commit67695f18d55924b2013534ef3bdc363bc9e14605
treedc5e74461c480d2190501c0b3cb8efc014949eb1
parentd021b442cf312664811783e92b3d5e4548e92a53
userfaultfd: fix mmap_changing checking in mfill_atomic_hugetlb

In mfill_atomic_hugetlb(), mmap_changing isn't being checked
again if we drop mmap_lock and reacquire it. When the lock is not held,
mmap_changing could have been incremented. This is also inconsistent
with the behavior in mfill_atomic().

Link: https://lkml.kernel.org/r/20240117223729.1444522-1-lokeshgidra@google.com
Fixes: df2cc96e77011 ("userfaultfd: prevent non-cooperative events vs mcopy_atomic races")
Signed-off-by: Lokesh Gidra <lokeshgidra@google.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Kalesh Singh <kaleshsingh@google.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Nicolas Geoffray <ngeoffray@google.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/userfaultfd.c