Skip to content

Commit

Permalink
fs: userfaultfd: convert rwsem sites to mmap_assert_*
Browse files Browse the repository at this point in the history
Change-Id: I22b6cc54539af833605f32d95b0a13582dc6abb8
Signed-off-by: Divyanshu-Modi <[email protected]>
  • Loading branch information
Divyanshu-Modi committed Dec 19, 2024
1 parent 687c5d2 commit df0433d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/userfaultfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ static inline bool userfaultfd_huge_must_wait(struct userfaultfd_ctx *ctx,
pte_t *ptep, pte;
bool ret = true;

VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem));
mmap_assert_locked(mm);

ptep = huge_pte_offset(mm, address, vma_mmu_pagesize(vma));

Expand Down Expand Up @@ -286,7 +286,7 @@ static inline bool userfaultfd_must_wait(struct userfaultfd_ctx *ctx,
pte_t *pte;
bool ret = true;

VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem));
mmap_assert_locked(mm);

pgd = pgd_offset(mm, address);
if (!pgd_present(*pgd))
Expand Down Expand Up @@ -400,7 +400,7 @@ vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason)
* Coredumping runs without mmap_sem so we can only check that
* the mmap_sem is held, if PF_DUMPCORE was not set.
*/
WARN_ON_ONCE(!rwsem_is_locked(&mm->mmap_sem));
mmap_assert_locked(mm);

ctx = vmf->vma->vm_userfaultfd_ctx.ctx;
if (!ctx)
Expand Down

0 comments on commit df0433d

Please sign in to comment.