]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/mmap.c: Fix mmap_write_lock() order in exit_mmap() for oom
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 21 Apr 2022 21:41:19 +0000 (17:41 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 21 Apr 2022 22:35:00 +0000 (18:35 -0400)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
mm/mmap.c

index 01dd9af0b13eeb284f2464fc1c62e03030ff0747..1d9d88d5239034964ec6767c407b9a332f02b19c 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3114,6 +3114,7 @@ void exit_mmap(struct mm_struct *mm)
        /* mm's last user has gone, and its about to be pulled down */
        mmu_notifier_release(mm);
 
+       mmap_write_lock(mm);
        if (unlikely(mm_is_oom_victim(mm))) {
                /*
                 * Manually reap the mm to free as much memory as possible.
@@ -3131,9 +3132,7 @@ void exit_mmap(struct mm_struct *mm)
                set_bit(MMF_OOM_SKIP, &mm->flags);
        }
 
-       mmap_write_lock(mm);
        arch_exit_mmap(mm);
-
        vma = mas_find(&mas, ULONG_MAX);
        if (!vma) {
                /* Can happen if dup_mmap() received an OOM */