summaryrefslogtreecommitdiffstats
path: root/mm/nommu.c
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2023-07-01 12:31:55 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2023-07-01 17:00:05 +0200
commit03f889378f33aa9a9d8e5f49ba94134cf6158090 (patch)
tree0cd0a31bf1619630f179e85729e6f7fd798f88d0 /mm/nommu.c
parentMerge tag '6.5-rc-smb3-client-fixes-part1' of git://git.samba.org/sfrench/cif... (diff)
downloadlinux-03f889378f33aa9a9d8e5f49ba94134cf6158090.tar.xz
linux-03f889378f33aa9a9d8e5f49ba94134cf6158090.zip
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: d85a143b69ab ("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>
Diffstat (limited to 'mm/nommu.c')
-rw-r--r--mm/nommu.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/nommu.c b/mm/nommu.c
index fdc392735ec6..c072a660ec2c 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -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;
}
/*