Skip to content

Commit 03f8893

Browse files
jcmvbkbctorvalds
authored andcommitted
xtensa: fix lock_mm_and_find_vma in case VMA not found
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>
1 parent a507db1 commit 03f8893

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

mm/nommu.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,13 @@ EXPORT_SYMBOL(find_vma);
637637
struct vm_area_struct *lock_mm_and_find_vma(struct mm_struct *mm,
638638
unsigned long addr, struct pt_regs *regs)
639639
{
640+
struct vm_area_struct *vma;
641+
640642
mmap_read_lock(mm);
641-
return vma_lookup(mm, addr);
643+
vma = vma_lookup(mm, addr);
644+
if (!vma)
645+
mmap_read_unlock(mm);
646+
return vma;
642647
}
643648

644649
/*

0 commit comments

Comments
 (0)