summaryrefslogtreecommitdiff
path: root/arch/arm64/kernel/sys.c
diff options
context:
space:
mode:
authorBoyang Zhou <zhouby_cn@126.com>2019-04-29 15:27:19 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-22 07:37:35 +0200
commit222abad906ba7e4727270930c681173d7d4769aa (patch)
tree3cd5d15935c18778989bb00d6671ee1f74c529f9 /arch/arm64/kernel/sys.c
parent592127e9c1bbc14795292a273faa006d805c7fe8 (diff)
arm64: mmap: Ensure file offset is treated as unsigned
commit f08cae2f28db24d95be5204046b60618d8de4ddc upstream. The file offset argument to the arm64 sys_mmap() implementation is scaled from bytes to pages by shifting right by PAGE_SHIFT. Unfortunately, the offset is passed in as a signed 'off_t' type and therefore large offsets (i.e. with the top bit set) are incorrectly sign-extended by the shift. This has been observed to cause false mmap() failures when mapping GPU doorbells on an arm64 server part. Change the type of the file offset argument to sys_mmap() from 'off_t' to 'unsigned long' so that the shifting scales the value as expected. Cc: <stable@vger.kernel.org> Signed-off-by: Boyang Zhou <zhouby_cn@126.com> [will: rewrote commit message] Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/arm64/kernel/sys.c')
-rw-r--r--arch/arm64/kernel/sys.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
index b44065fb1616..6f91e8116514 100644
--- a/arch/arm64/kernel/sys.c
+++ b/arch/arm64/kernel/sys.c
@@ -31,7 +31,7 @@
SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
unsigned long, prot, unsigned long, flags,
- unsigned long, fd, off_t, off)
+ unsigned long, fd, unsigned long, off)
{
if (offset_in_page(off) != 0)
return -EINVAL;