m68k: Add missing mmap_read_lock() to sys_cacheflush()
PATCH 1/1 m68k: Add missing mmap_read_lock() to sys_cacheflush()
From: Liam Howlett <[email protected]>
[ 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.
--- arch/m68k/kernel/sys_m68k.c | 2 ++ 1 file changed, 2 insertions(+)
arch/m68k/kernel/sys_m68k.c +2 -0
@@ -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; + +down_read (¤t->mm->mmap_sem); }else {struct vm_area_struct *vma;
[ Sasha's backport helper bot ]
Hi,
The upstream commit SHA1 provided is correct: f829b4b212a315b912cb23fd10aaf30534bb5ce9
WARNING: Author mismatch between patch and upstream commit:
Backport author: Finn Thain<[email protected]> Commit author: Liam Howlett<[email protected]>
Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)
5.15.y | Present (exact SHA1)
5.10.y | Present (different SHA1: 58ee5a0de192)
5.4.y | Not found
Note: The patch differs from the upstream commit:
---
1: f829b4b212a31 ! 1: 9f4fbaa4b6d79 m68k: Add missing mmap_read_lock() to sys_cacheflush()
@@ Metadata
## Commit message ##
m68k: Add missing mmap_read_lock() to sys_cacheflush()
+ [ 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.
@@ Commit message
+ [ mmap_read_lock() open-coded using down_read() as was done prior to v5.8 ]
+ Signed-off-by: Finn Thain <[email protected]>
## arch/m68k/kernel/sys_m68k.c ##
@@ arch/m68k/kernel/sys_m68k.c: sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
@@ arch/m68k/kernel/sys_m68k.c: sys_cacheflush (unsigned long addr, int scope, int
if (!capable(CAP_SYS_ADMIN))
goto out;
+
-+ mmap_read_lock(current->mm);
++ down_read(¤t->mm->mmap_sem);
} else {
struct vm_area_struct *vma;
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.4.y | Success | Success |