Skip to content

Commit

Permalink
xtensa: fix lock_mm_and_find_vma in case VMA not found
Browse files Browse the repository at this point in the history
commit 03f8893 upstream.

MMU version of lock_mm_and_find_vma releases the mm lock before
returning when VMA is not found. Do the same in noMMU version.
This fixes hang on an attempt to handle protection fault.

Fixes: d85a143 ("xtensa: fix NOMMU build with lock_mm_and_find_vma() conversion")
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
jcmvbkbc authored and gregkh committed Jul 5, 2023
1 parent 5937767 commit 8911865
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mm/nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,13 @@ EXPORT_SYMBOL(find_vma);
struct vm_area_struct *lock_mm_and_find_vma(struct mm_struct *mm,
unsigned long addr, struct pt_regs *regs)
{
struct vm_area_struct *vma;

mmap_read_lock(mm);
return vma_lookup(mm, addr);
vma = vma_lookup(mm, addr);
if (!vma)
mmap_read_unlock(mm);
return vma;
}

/*
Expand Down

0 comments on commit 8911865

Please sign in to comment.