[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230701103155.1209274-1-jcmvbkbc@gmail.com>
Date: Sat, 1 Jul 2023 03:31:55 -0700
From: Max Filippov <jcmvbkbc@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, Chris Zankel <chris@...kel.net>,
Guenter Roeck <linux@...ck-us.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Max Filippov <jcmvbkbc@...il.com>
Subject: [PATCH] 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@...il.com>
---
mm/nommu.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
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;
}
/*
--
2.30.2
Powered by blists - more mailing lists