Skip to content

Commit 6b2849b

Browse files
jcmvbkbcgregkh
authored andcommitted
xtensa: fix lock_mm_and_find_vma in case VMA not found
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 <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0f4ac6b commit 6b2849b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mm/nommu.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,13 @@ EXPORT_SYMBOL(find_vma);
688688
struct vm_area_struct *lock_mm_and_find_vma(struct mm_struct *mm,
689689
unsigned long addr, struct pt_regs *regs)
690690
{
691+
struct vm_area_struct *vma;
692+
691693
mmap_read_lock(mm);
692-
return vma_lookup(mm, addr);
694+
vma = vma_lookup(mm, addr);
695+
if (!vma)
696+
mmap_read_unlock(mm);
697+
return vma;
693698
}
694699

695700
/*

0 commit comments

Comments
 (0)