Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: validate the mm before dropping the mmap lock

Commit 408579cd627a ("mm: Update do_vmi_align_munmap() return
semantics") made the return value and locking semantics of
do_vmi_align_munmap() more straightforward, but in the process it ended
up unlocking the mmap lock just a tad too early: the debug code doing
the mmap layout validation still needs to run with the lock held, or
things might change under it while it's trying to validate things.

So just move the unlocking to after the validate_mm() call.

Reported-by: kernel test robot <oliver.sang@intel.com>
Link: https://lore.kernel.org/lkml/ZKIsoMOT71uwCIZX@xsang-OptiPlex-9020/
Fixes: 408579cd627a ("mm: Update do_vmi_align_munmap() return semantics")
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+1 -2
+1 -2
mm/mmap.c
··· 2554 2554 mas_set(&mas_detach, start); 2555 2555 remove_mt(mm, &mas_detach); 2556 2556 __mt_destroy(&mt_detach); 2557 + validate_mm(mm); 2557 2558 if (unlock) 2558 2559 mmap_read_unlock(mm); 2559 2560 2560 - 2561 - validate_mm(mm); 2562 2561 return 0; 2563 2562 2564 2563 clear_tree_failed: