mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
m68k: fix access_ok for coldfire
commit 26509034be
upstream.
While most m68k platforms use separate address spaces for user
and kernel space, at least coldfire does not, and the other
ones have a TASK_SIZE that is less than the entire 4GB address
range.
Using the default implementation of __access_ok() stops coldfire
user space from trivially accessing kernel memory.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: stable@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
bed07e7ecc
commit
b7509a4e81
1 changed files with 9 additions and 6 deletions
|
@ -12,14 +12,17 @@
|
|||
#include <asm/extable.h>
|
||||
|
||||
/* We let the MMU do all checking */
|
||||
static inline int access_ok(const void __user *addr,
|
||||
static inline int access_ok(const void __user *ptr,
|
||||
unsigned long size)
|
||||
{
|
||||
/*
|
||||
* XXX: for !CONFIG_CPU_HAS_ADDRESS_SPACES this really needs to check
|
||||
* for TASK_SIZE!
|
||||
*/
|
||||
return 1;
|
||||
unsigned long limit = TASK_SIZE;
|
||||
unsigned long addr = (unsigned long)ptr;
|
||||
|
||||
if (IS_ENABLED(CONFIG_CPU_HAS_ADDRESS_SPACES) ||
|
||||
!IS_ENABLED(CONFIG_MMU))
|
||||
return 1;
|
||||
|
||||
return (size <= limit) && (addr <= (limit - size));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue