diff options
author | Michal Simek <michal.simek@xilinx.com> | 2013-09-16 01:46:23 -0400 |
---|---|---|
committer | Michal Simek <michal.simek@xilinx.com> | 2013-11-08 09:20:44 -0500 |
commit | 99399545d62533b4ae742190b5c6b11f7a5826d9 (patch) | |
tree | d7f6ab88f9a71f301ad5294d1572c939a2155b70 | |
parent | 176195e757df0044623b2086527ad5b5cfde9488 (diff) |
microblaze: Fix bug with mmap2 syscall MB implementation
Fix mmap2 behaviour which incorrectly works with pgoff
not in 4k units.
Reported-by: Rich Felker <dalias@aerifal.cx>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
-rw-r--r-- | arch/microblaze/kernel/sys_microblaze.c | 11 | ||||
-rw-r--r-- | arch/microblaze/kernel/syscall_table.S | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c index e80a6c02ac31..f1e1f666ddde 100644 --- a/arch/microblaze/kernel/sys_microblaze.c +++ b/arch/microblaze/kernel/sys_microblaze.c | |||
@@ -42,3 +42,14 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, | |||
42 | 42 | ||
43 | return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); | 43 | return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); |
44 | } | 44 | } |
45 | |||
46 | SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, | ||
47 | unsigned long, prot, unsigned long, flags, unsigned long, fd, | ||
48 | unsigned long, pgoff) | ||
49 | { | ||
50 | if (pgoff & (~PAGE_MASK >> 12)) | ||
51 | return -EINVAL; | ||
52 | |||
53 | return sys_mmap_pgoff(addr, len, prot, flags, fd, | ||
54 | pgoff >> (PAGE_SHIFT - 12)); | ||
55 | } | ||
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S index 4fca56cf02f6..b882ad50535b 100644 --- a/arch/microblaze/kernel/syscall_table.S +++ b/arch/microblaze/kernel/syscall_table.S | |||
@@ -192,7 +192,7 @@ ENTRY(sys_call_table) | |||
192 | .long sys_ni_syscall /* reserved for streams2 */ | 192 | .long sys_ni_syscall /* reserved for streams2 */ |
193 | .long sys_vfork /* 190 */ | 193 | .long sys_vfork /* 190 */ |
194 | .long sys_getrlimit | 194 | .long sys_getrlimit |
195 | .long sys_mmap_pgoff /* mmap2 */ | 195 | .long sys_mmap2 |
196 | .long sys_truncate64 | 196 | .long sys_truncate64 |
197 | .long sys_ftruncate64 | 197 | .long sys_ftruncate64 |
198 | .long sys_stat64 /* 195 */ | 198 | .long sys_stat64 /* 195 */ |