Skip to content

Commit

Permalink
mm/mmap.c: use mmap_assert_write_locked() instead of open coding it
Browse files Browse the repository at this point in the history
In case the lock is actually not held at this point.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Rolf Eike Beer <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
DerDakon authored and akpm00 committed Apr 29, 2022
1 parent 241ec63 commit 325bca1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 325bca1

Please sign in to comment.