Take mmap lock in cacheflush syscall
authorJann Horn <jannh@google.com>
Fri, 19 Feb 2021 06:59:35 +0000 (14:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:38:16 +0000 (11:38 +0100)
commit9dfb367a23827e4b85872d09f6c57e79b33fa2fd
treecc2ece5f46c6281868db6735bc273bd94eaf41c6
parent5917fdcc554d230c5dae0d3cc03647d1f89898a6
Take mmap lock in cacheflush syscall

[ Upstream commit c26958cb5a0d9053d1358258827638773f3d36ed ]

We need to take the mmap lock around find_vma() and subsequent use of the
VMA. Otherwise, we can race with concurrent operations like munmap(), which
can lead to use-after-free accesses to freed VMAs.

Fixes: 1000197d8013 ("nios2: System calls handling")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/nios2/kernel/sys_nios2.c