]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/mmap.c: use mmap_assert_write_locked() instead of open coding it
authorRolf Eike Beer <eb@emlix.com>
Thu, 14 Apr 2022 06:07:05 +0000 (23:07 -0700)
committerakpm <akpm@linux-foundation.org>
Thu, 14 Apr 2022 06:07:05 +0000 (23:07 -0700)
In case the lock is actually not held at this point.

Link: https://lkml.kernel.org/r/5827758.TJ1SttVevJ@mobilepool36.emlix.com
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mmap.c

index 3aa839f81e63dc8645506af8c99c870b33afd6d8..d62598dc2fdd2ef4036a3685b2b8dfd392837cdf 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3561,7 +3561,7 @@ int mm_take_all_locks(struct mm_struct *mm)
        struct vm_area_struct *vma;
        struct anon_vma_chain *avc;
 
-       BUG_ON(mmap_read_trylock(mm));
+       mmap_assert_write_locked(mm);
 
        mutex_lock(&mm_all_locks_mutex);
 
@@ -3641,7 +3641,7 @@ void mm_drop_all_locks(struct mm_struct *mm)
        struct vm_area_struct *vma;
        struct anon_vma_chain *avc;
 
-       BUG_ON(mmap_read_trylock(mm));
+       mmap_assert_write_locked(mm);
        BUG_ON(!mutex_is_locked(&mm_all_locks_mutex));
 
        for (vma = mm->mmap; vma; vma = vma->vm_next) {