Commit 325bca1f authored by Rolf Eike Beer's avatar Rolf Eike Beer Committed by Andrew Morton
Browse files

mm/mmap.c: use mmap_assert_write_locked() instead of open coding it

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: default avatarRolf Eike Beer <eb@emlix.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 241ec63a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3553,7 +3553,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);

@@ -3633,7 +3633,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) {