mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
ARM: Remove address checking for MMUless devices
commit 3ccea4784fddd96fbd6c4497eb28b45dab638c2a upstream.
Commit 169f9102f9198b ("ARM: 9350/1: fault: Implement
copy_from_kernel_nofault_allowed()") added the function to check address
before use. However, for devices without MMU, addr > TASK_SIZE will
always fail. This patch move this function after the #ifdef CONFIG_MMU
statement.
Signed-off-by: Yanjun Yang <yangyj.ee@gmail.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218953
Fixes: 169f9102f9198b ("ARM: 9350/1: fault: Implement copy_from_kernel_nofault_allowed()")
Link: https://lore.kernel.org/r/20240611100947.32241-1-yangyj.ee@gmail.com
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
01469773db
commit
79e5030717
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include "fault.h"
|
#include "fault.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_MMU
|
||||||
|
|
||||||
bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size)
|
bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size)
|
||||||
{
|
{
|
||||||
unsigned long addr = (unsigned long)unsafe_src;
|
unsigned long addr = (unsigned long)unsafe_src;
|
||||||
@@ -32,8 +34,6 @@ bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size)
|
|||||||
return addr >= TASK_SIZE && ULONG_MAX - addr >= size;
|
return addr >= TASK_SIZE && ULONG_MAX - addr >= size;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MMU
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is useful to dump out the page tables associated with
|
* This is useful to dump out the page tables associated with
|
||||||
* 'addr' in mm 'mm'.
|
* 'addr' in mm 'mm'.
|
||||||
|
|||||||
Reference in New Issue
Block a user