]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
microblaze: Fix bug with mmap2 syscall MB implementation
authorMichal Simek <michal.simek@xilinx.com>
Mon, 16 Sep 2013 05:46:23 +0000 (07:46 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 8 Nov 2013 14:20:44 +0000 (15:20 +0100)
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>
arch/microblaze/kernel/sys_microblaze.c
arch/microblaze/kernel/syscall_table.S

index e80a6c02ac31d99ed6f8681cbcc98a449320587d..f1e1f666ddde214b2cbc4a688e34b3e37acfaf63 100644 (file)
@@ -42,3 +42,14 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
 
        return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
 }
+
+SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
+               unsigned long, prot, unsigned long, flags, unsigned long, fd,
+               unsigned long, pgoff)
+{
+       if (pgoff & (~PAGE_MASK >> 12))
+               return -EINVAL;
+
+       return sys_mmap_pgoff(addr, len, prot, flags, fd,
+                             pgoff >> (PAGE_SHIFT - 12));
+}
index 4fca56cf02f6f0c43bdac35be3eadfb55b57bc2f..b882ad50535b8b1143af60b5af1b3de007060fb6 100644 (file)
@@ -192,7 +192,7 @@ ENTRY(sys_call_table)
        .long sys_ni_syscall            /* reserved for streams2 */
        .long sys_vfork         /* 190 */
        .long sys_getrlimit
-       .long sys_mmap_pgoff            /* mmap2 */
+       .long sys_mmap2
        .long sys_truncate64
        .long sys_ftruncate64
        .long sys_stat64                /* 195 */