m68k: Add missing mmap_read_lock() to sys_cacheflush()
authorLiam Howlett <liam.howlett@oracle.com>
Wed, 7 Apr 2021 20:00:45 +0000 (20:00 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 07:50:19 +0000 (09:50 +0200)
[ Upstream commit f829b4b212a315b912cb23fd10aaf30534bb5ce9 ]

When the superuser flushes the entire cache, the mmap_read_lock() is not
taken, but mmap_read_unlock() is called.  Add the missing
mmap_read_lock() call.

Fixes: cd2567b6850b1648 ("m68k: call find_vma with the mmap_sem held in sys_cacheflush()")
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Link: https://lore.kernel.org/r/20210407200032.764445-1-Liam.Howlett@Oracle.com
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/m68k/kernel/sys_m68k.c

index 1c235d8f53f36dbb5669e15be107de1a7abe3920..f55bdcb8e4f15723d1cc4333ea04a05e9835a08b 100644 (file)
@@ -388,6 +388,8 @@ sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
                ret = -EPERM;
                if (!capable(CAP_SYS_ADMIN))
                        goto out;
+
+               mmap_read_lock(current->mm);
        } else {
                struct vm_area_struct *vma;