diff options
| -rw-r--r-- | arch/s390/include/asm/bug.h | 4 | ||||
| -rw-r--r-- | arch/s390/include/asm/sigp.h | 20 | ||||
| -rw-r--r-- | arch/s390/include/asm/thread_info.h | 12 | ||||
| -rw-r--r-- | arch/s390/include/asm/unistd.h | 6 | ||||
| -rw-r--r-- | arch/s390/kernel/compat_linux.c | 41 | ||||
| -rw-r--r-- | arch/s390/kernel/compat_wrapper.S | 9 | ||||
| -rw-r--r-- | arch/s390/kernel/process.c | 3 | ||||
| -rw-r--r-- | arch/s390/kernel/ptrace.c | 8 | ||||
| -rw-r--r-- | arch/s390/kernel/setup.c | 8 | ||||
| -rw-r--r-- | arch/s390/kernel/signal.c | 10 | ||||
| -rw-r--r-- | arch/s390/kernel/smp.c | 9 | ||||
| -rw-r--r-- | arch/s390/kernel/syscalls.S | 1 | ||||
| -rw-r--r-- | arch/s390/kernel/topology.c | 2 | ||||
| -rw-r--r-- | arch/s390/lib/spinlock.c | 2 | ||||
| -rw-r--r-- | arch/s390/mm/mmap.c | 4 | ||||
| -rw-r--r-- | drivers/s390/block/dasd_eckd.c | 14 | ||||
| -rw-r--r-- | drivers/s390/block/dasd_ioctl.c | 14 | ||||
| -rw-r--r-- | drivers/s390/char/con3215.c | 17 | ||||
| -rw-r--r-- | drivers/s390/char/fs3270.c | 17 | ||||
| -rw-r--r-- | drivers/s390/char/tape_block.c | 39 | ||||
| -rw-r--r-- | drivers/s390/char/tape_char.c | 18 | ||||
| -rw-r--r-- | drivers/s390/char/vmcp.c | 12 | ||||
| -rw-r--r-- | drivers/s390/cio/chsc_sch.c | 23 | ||||
| -rw-r--r-- | drivers/s390/crypto/zcrypt_api.c | 4 |
24 files changed, 137 insertions, 160 deletions
diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h index efb74fd5156e..b1066b9fb5f8 100644 --- a/arch/s390/include/asm/bug.h +++ b/arch/s390/include/asm/bug.h | |||
| @@ -52,6 +52,10 @@ | |||
| 52 | unreachable(); \ | 52 | unreachable(); \ |
| 53 | } while (0) | 53 | } while (0) |
| 54 | 54 | ||
| 55 | #define __WARN() do { \ | ||
| 56 | __EMIT_BUG(BUGFLAG_WARNING); \ | ||
| 57 | } while (0) | ||
| 58 | |||
| 55 | #define WARN_ON(x) ({ \ | 59 | #define WARN_ON(x) ({ \ |
| 56 | int __ret_warn_on = !!(x); \ | 60 | int __ret_warn_on = !!(x); \ |
| 57 | if (__builtin_constant_p(__ret_warn_on)) { \ | 61 | if (__builtin_constant_p(__ret_warn_on)) { \ |
diff --git a/arch/s390/include/asm/sigp.h b/arch/s390/include/asm/sigp.h index ec403d4304f8..f72d611f7e13 100644 --- a/arch/s390/include/asm/sigp.h +++ b/arch/s390/include/asm/sigp.h | |||
| @@ -15,11 +15,19 @@ | |||
| 15 | #ifndef __SIGP__ | 15 | #ifndef __SIGP__ |
| 16 | #define __SIGP__ | 16 | #define __SIGP__ |
| 17 | 17 | ||
| 18 | #include <asm/ptrace.h> | 18 | #include <asm/system.h> |
| 19 | #include <asm/atomic.h> | ||
| 20 | 19 | ||
| 21 | /* get real cpu address from logical cpu number */ | 20 | /* get real cpu address from logical cpu number */ |
| 22 | extern volatile int __cpu_logical_map[]; | 21 | extern int __cpu_logical_map[]; |
| 22 | |||
| 23 | static inline int cpu_logical_map(int cpu) | ||
| 24 | { | ||
| 25 | #ifdef CONFIG_SMP | ||
| 26 | return __cpu_logical_map[cpu]; | ||
| 27 | #else | ||
| 28 | return stap(); | ||
| 29 | #endif | ||
| 30 | } | ||
| 23 | 31 | ||
| 24 | typedef enum | 32 | typedef enum |
| 25 | { | 33 | { |
| @@ -79,7 +87,7 @@ signal_processor(__u16 cpu_addr, sigp_order_code order_code) | |||
| 79 | " ipm %0\n" | 87 | " ipm %0\n" |
| 80 | " srl %0,28\n" | 88 | " srl %0,28\n" |
| 81 | : "=d" (ccode) | 89 | : "=d" (ccode) |
| 82 | : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]), | 90 | : "d" (reg1), "d" (cpu_logical_map(cpu_addr)), |
| 83 | "a" (order_code) : "cc" , "memory"); | 91 | "a" (order_code) : "cc" , "memory"); |
| 84 | return ccode; | 92 | return ccode; |
| 85 | } | 93 | } |
| @@ -98,7 +106,7 @@ signal_processor_p(__u32 parameter, __u16 cpu_addr, sigp_order_code order_code) | |||
| 98 | " ipm %0\n" | 106 | " ipm %0\n" |
| 99 | " srl %0,28\n" | 107 | " srl %0,28\n" |
| 100 | : "=d" (ccode) | 108 | : "=d" (ccode) |
| 101 | : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]), | 109 | : "d" (reg1), "d" (cpu_logical_map(cpu_addr)), |
| 102 | "a" (order_code) : "cc" , "memory"); | 110 | "a" (order_code) : "cc" , "memory"); |
| 103 | return ccode; | 111 | return ccode; |
| 104 | } | 112 | } |
| @@ -118,7 +126,7 @@ signal_processor_ps(__u32 *statusptr, __u32 parameter, __u16 cpu_addr, | |||
| 118 | " ipm %0\n" | 126 | " ipm %0\n" |
| 119 | " srl %0,28\n" | 127 | " srl %0,28\n" |
| 120 | : "=d" (ccode), "+d" (reg1) | 128 | : "=d" (ccode), "+d" (reg1) |
| 121 | : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code) | 129 | : "d" (cpu_logical_map(cpu_addr)), "a" (order_code) |
| 122 | : "cc" , "memory"); | 130 | : "cc" , "memory"); |
| 123 | *statusptr = reg1; | 131 | *statusptr = reg1; |
| 124 | return ccode; | 132 | return ccode; |
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h index 07eb61b2fb3a..66069e736842 100644 --- a/arch/s390/include/asm/thread_info.h +++ b/arch/s390/include/asm/thread_info.h | |||
| @@ -93,13 +93,12 @@ static inline struct thread_info *current_thread_info(void) | |||
| 93 | #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ | 93 | #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */ |
| 94 | #define TIF_SECCOMP 10 /* secure computing */ | 94 | #define TIF_SECCOMP 10 /* secure computing */ |
| 95 | #define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ | 95 | #define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */ |
| 96 | #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ | 96 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling |
| 97 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling | ||
| 98 | TIF_NEED_RESCHED */ | 97 | TIF_NEED_RESCHED */ |
| 99 | #define TIF_31BIT 18 /* 32bit process */ | 98 | #define TIF_31BIT 17 /* 32bit process */ |
| 100 | #define TIF_MEMDIE 19 | 99 | #define TIF_MEMDIE 18 |
| 101 | #define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */ | 100 | #define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */ |
| 102 | #define TIF_FREEZE 21 /* thread is freezing for suspend */ | 101 | #define TIF_FREEZE 20 /* thread is freezing for suspend */ |
| 103 | 102 | ||
| 104 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 103 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
| 105 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) | 104 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) |
| @@ -112,7 +111,6 @@ static inline struct thread_info *current_thread_info(void) | |||
| 112 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | 111 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) |
| 113 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | 112 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
| 114 | #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) | 113 | #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) |
| 115 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) | ||
| 116 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | 114 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
| 117 | #define _TIF_31BIT (1<<TIF_31BIT) | 115 | #define _TIF_31BIT (1<<TIF_31BIT) |
| 118 | #define _TIF_FREEZE (1<<TIF_FREEZE) | 116 | #define _TIF_FREEZE (1<<TIF_FREEZE) |
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h index 192a7203a14f..6e9f049fa823 100644 --- a/arch/s390/include/asm/unistd.h +++ b/arch/s390/include/asm/unistd.h | |||
| @@ -269,8 +269,7 @@ | |||
| 269 | #define __NR_pwritev 329 | 269 | #define __NR_pwritev 329 |
| 270 | #define __NR_rt_tgsigqueueinfo 330 | 270 | #define __NR_rt_tgsigqueueinfo 330 |
| 271 | #define __NR_perf_event_open 331 | 271 | #define __NR_perf_event_open 331 |
| 272 | #define __NR_recvmmsg 332 | 272 | #define NR_syscalls 332 |
| 273 | #define NR_syscalls 333 | ||
| 274 | 273 | ||
| 275 | /* | 274 | /* |
| 276 | * There are some system calls that are not present on 64 bit, some | 275 | * There are some system calls that are not present on 64 bit, some |
| @@ -377,6 +376,9 @@ | |||
| 377 | #define __IGNORE_migrate_pages | 376 | #define __IGNORE_migrate_pages |
| 378 | #define __IGNORE_move_pages | 377 | #define __IGNORE_move_pages |
| 379 | 378 | ||
| 379 | /* Ignore system calls that are also reachable via sys_socket */ | ||
| 380 | #define __IGNORE_recvmmsg | ||
| 381 | |||
| 380 | #define __ARCH_WANT_IPC_PARSE_VERSION | 382 | #define __ARCH_WANT_IPC_PARSE_VERSION |
| 381 | #define __ARCH_WANT_OLD_READDIR | 383 | #define __ARCH_WANT_OLD_READDIR |
| 382 | #define __ARCH_WANT_SYS_ALARM | 384 | #define __ARCH_WANT_SYS_ALARM |
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index 22c9e557bb22..11c3aba664ea 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c | |||
| @@ -616,44 +616,35 @@ asmlinkage long sys32_fstatat64(unsigned int dfd, char __user *filename, | |||
| 616 | */ | 616 | */ |
| 617 | 617 | ||
| 618 | struct mmap_arg_struct_emu31 { | 618 | struct mmap_arg_struct_emu31 { |
| 619 | u32 addr; | 619 | compat_ulong_t addr; |
| 620 | u32 len; | 620 | compat_ulong_t len; |
| 621 | u32 prot; | 621 | compat_ulong_t prot; |
| 622 | u32 flags; | 622 | compat_ulong_t flags; |
| 623 | u32 fd; | 623 | compat_ulong_t fd; |
| 624 | u32 offset; | 624 | compat_ulong_t offset; |
| 625 | }; | 625 | }; |
| 626 | 626 | ||
| 627 | asmlinkage unsigned long | 627 | asmlinkage unsigned long old32_mmap(struct mmap_arg_struct_emu31 __user *arg) |
| 628 | old32_mmap(struct mmap_arg_struct_emu31 __user *arg) | ||
| 629 | { | 628 | { |
| 630 | struct mmap_arg_struct_emu31 a; | 629 | struct mmap_arg_struct_emu31 a; |
| 631 | int error = -EFAULT; | ||
| 632 | 630 | ||
| 633 | if (copy_from_user(&a, arg, sizeof(a))) | 631 | if (copy_from_user(&a, arg, sizeof(a))) |
| 634 | goto out; | 632 | return -EFAULT; |
| 635 | |||
| 636 | error = -EINVAL; | ||
| 637 | if (a.offset & ~PAGE_MASK) | 633 | if (a.offset & ~PAGE_MASK) |
| 638 | goto out; | 634 | return -EINVAL; |
| 639 | 635 | a.addr = (unsigned long) compat_ptr(a.addr); | |
| 640 | error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | 636 | return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, |
| 641 | a.offset >> PAGE_SHIFT); | 637 | a.offset >> PAGE_SHIFT); |
| 642 | out: | ||
| 643 | return error; | ||
| 644 | } | 638 | } |
| 645 | 639 | ||
| 646 | asmlinkage long | 640 | asmlinkage long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg) |
| 647 | sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg) | ||
| 648 | { | 641 | { |
| 649 | struct mmap_arg_struct_emu31 a; | 642 | struct mmap_arg_struct_emu31 a; |
| 650 | int error = -EFAULT; | ||
| 651 | 643 | ||
| 652 | if (copy_from_user(&a, arg, sizeof(a))) | 644 | if (copy_from_user(&a, arg, sizeof(a))) |
| 653 | goto out; | 645 | return -EFAULT; |
| 654 | error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); | 646 | a.addr = (unsigned long) compat_ptr(a.addr); |
| 655 | out: | 647 | return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); |
| 656 | return error; | ||
| 657 | } | 648 | } |
| 658 | 649 | ||
| 659 | asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count) | 650 | asmlinkage long sys32_read(unsigned int fd, char __user * buf, size_t count) |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index faeaccc7d7d9..30de2d0e52bb 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
| @@ -1853,12 +1853,3 @@ sys32_execve_wrapper: | |||
| 1853 | llgtr %r3,%r3 # compat_uptr_t * | 1853 | llgtr %r3,%r3 # compat_uptr_t * |
| 1854 | llgtr %r4,%r4 # compat_uptr_t * | 1854 | llgtr %r4,%r4 # compat_uptr_t * |
| 1855 | jg sys32_execve # branch to system call | 1855 | jg sys32_execve # branch to system call |
| 1856 | |||
| 1857 | .globl compat_sys_recvmmsg_wrapper | ||
| 1858 | compat_sys_recvmmsg_wrapper: | ||
| 1859 | lgfr %r2,%r2 # int | ||
| 1860 | llgtr %r3,%r3 # struct compat_mmsghdr * | ||
| 1861 | llgfr %r4,%r4 # unsigned int | ||
| 1862 | llgfr %r5,%r5 # unsigned int | ||
| 1863 | llgtr %r6,%r6 # struct compat_timespec * | ||
| 1864 | jg compat_sys_recvmmsg | ||
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 5417eb57271a..00b6d1d292f2 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c | |||
| @@ -153,8 +153,6 @@ void exit_thread(void) | |||
| 153 | 153 | ||
| 154 | void flush_thread(void) | 154 | void flush_thread(void) |
| 155 | { | 155 | { |
| 156 | clear_used_math(); | ||
| 157 | clear_tsk_thread_flag(current, TIF_USEDFPU); | ||
| 158 | } | 156 | } |
| 159 | 157 | ||
| 160 | void release_thread(struct task_struct *dead_task) | 158 | void release_thread(struct task_struct *dead_task) |
| @@ -217,6 +215,7 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp, | |||
| 217 | p->thread.mm_segment = get_fs(); | 215 | p->thread.mm_segment = get_fs(); |
| 218 | /* Don't copy debug registers */ | 216 | /* Don't copy debug registers */ |
| 219 | memset(&p->thread.per_info, 0, sizeof(p->thread.per_info)); | 217 | memset(&p->thread.per_info, 0, sizeof(p->thread.per_info)); |
| 218 | clear_tsk_thread_flag(p, TIF_SINGLE_STEP); | ||
| 220 | /* Initialize per thread user and system timer values */ | 219 | /* Initialize per thread user and system timer values */ |
| 221 | ti = task_thread_info(p); | 220 | ti = task_thread_info(p); |
| 222 | ti->user_timer = 0; | 221 | ti->user_timer = 0; |
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 13815d39f7dd..7cf464234419 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
| @@ -65,6 +65,7 @@ FixPerRegisters(struct task_struct *task) | |||
| 65 | { | 65 | { |
| 66 | struct pt_regs *regs; | 66 | struct pt_regs *regs; |
| 67 | per_struct *per_info; | 67 | per_struct *per_info; |
| 68 | per_cr_words cr_words; | ||
| 68 | 69 | ||
| 69 | regs = task_pt_regs(task); | 70 | regs = task_pt_regs(task); |
| 70 | per_info = (per_struct *) &task->thread.per_info; | 71 | per_info = (per_struct *) &task->thread.per_info; |
| @@ -98,6 +99,13 @@ FixPerRegisters(struct task_struct *task) | |||
| 98 | per_info->control_regs.bits.storage_alt_space_ctl = 1; | 99 | per_info->control_regs.bits.storage_alt_space_ctl = 1; |
| 99 | else | 100 | else |
| 100 | per_info->control_regs.bits.storage_alt_space_ctl = 0; | 101 | per_info->control_regs.bits.storage_alt_space_ctl = 0; |
| 102 | |||
| 103 | if (task == current) { | ||
| 104 | __ctl_store(cr_words, 9, 11); | ||
| 105 | if (memcmp(&cr_words, &per_info->control_regs.words, | ||
| 106 | sizeof(cr_words)) != 0) | ||
| 107 | __ctl_load(per_info->control_regs.words, 9, 11); | ||
| 108 | } | ||
| 101 | } | 109 | } |
| 102 | 110 | ||
| 103 | void user_enable_single_step(struct task_struct *task) | 111 | void user_enable_single_step(struct task_struct *task) |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 0663287fa1b3..8d8957b38ab3 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
| @@ -87,7 +87,6 @@ unsigned long elf_hwcap = 0; | |||
| 87 | char elf_platform[ELF_PLATFORM_SIZE]; | 87 | char elf_platform[ELF_PLATFORM_SIZE]; |
| 88 | 88 | ||
| 89 | struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; | 89 | struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; |
| 90 | volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */ | ||
| 91 | 90 | ||
| 92 | int __initdata memory_end_set; | 91 | int __initdata memory_end_set; |
| 93 | unsigned long __initdata memory_end; | 92 | unsigned long __initdata memory_end; |
| @@ -124,12 +123,6 @@ void __cpuinit cpu_init(void) | |||
| 124 | */ | 123 | */ |
| 125 | get_cpu_id(&S390_lowcore.cpu_id); | 124 | get_cpu_id(&S390_lowcore.cpu_id); |
| 126 | 125 | ||
| 127 | /* | ||
| 128 | * Force FPU initialization: | ||
| 129 | */ | ||
| 130 | clear_thread_flag(TIF_USEDFPU); | ||
| 131 | clear_used_math(); | ||
| 132 | |||
| 133 | atomic_inc(&init_mm.mm_count); | 126 | atomic_inc(&init_mm.mm_count); |
| 134 | current->active_mm = &init_mm; | 127 | current->active_mm = &init_mm; |
| 135 | BUG_ON(current->mm); | 128 | BUG_ON(current->mm); |
| @@ -855,7 +848,6 @@ setup_arch(char **cmdline_p) | |||
| 855 | setup_lowcore(); | 848 | setup_lowcore(); |
| 856 | 849 | ||
| 857 | cpu_init(); | 850 | cpu_init(); |
| 858 | __cpu_logical_map[0] = stap(); | ||
| 859 | s390_init_cpu_topology(); | 851 | s390_init_cpu_topology(); |
| 860 | 852 | ||
| 861 | /* | 853 | /* |
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c index 6b4fef877f9d..1675c48b9145 100644 --- a/arch/s390/kernel/signal.c +++ b/arch/s390/kernel/signal.c | |||
| @@ -500,18 +500,10 @@ void do_signal(struct pt_regs *regs) | |||
| 500 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 500 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
| 501 | 501 | ||
| 502 | /* | 502 | /* |
| 503 | * If we would have taken a single-step trap | ||
| 504 | * for a normal instruction, act like we took | ||
| 505 | * one for the handler setup. | ||
| 506 | */ | ||
| 507 | if (current->thread.per_info.single_step) | ||
| 508 | set_thread_flag(TIF_SINGLE_STEP); | ||
| 509 | |||
| 510 | /* | ||
| 511 | * Let tracing know that we've done the handler setup. | 503 | * Let tracing know that we've done the handler setup. |
| 512 | */ | 504 | */ |
| 513 | tracehook_signal_handler(signr, &info, &ka, regs, | 505 | tracehook_signal_handler(signr, &info, &ka, regs, |
| 514 | test_thread_flag(TIF_SINGLE_STEP)); | 506 | current->thread.per_info.single_step); |
| 515 | } | 507 | } |
| 516 | return; | 508 | return; |
| 517 | } | 509 | } |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 93e52039321b..76a6fdd46c45 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
| @@ -52,6 +52,9 @@ | |||
| 52 | #include <asm/cpu.h> | 52 | #include <asm/cpu.h> |
| 53 | #include "entry.h" | 53 | #include "entry.h" |
| 54 | 54 | ||
| 55 | /* logical cpu to cpu address */ | ||
| 56 | int __cpu_logical_map[NR_CPUS]; | ||
| 57 | |||
| 55 | static struct task_struct *current_set[NR_CPUS]; | 58 | static struct task_struct *current_set[NR_CPUS]; |
| 56 | 59 | ||
| 57 | static u8 smp_cpu_type; | 60 | static u8 smp_cpu_type; |
| @@ -717,6 +720,12 @@ void __init smp_cpus_done(unsigned int max_cpus) | |||
| 717 | { | 720 | { |
| 718 | } | 721 | } |
| 719 | 722 | ||
| 723 | void __init smp_setup_processor_id(void) | ||
| 724 | { | ||
| 725 | S390_lowcore.cpu_nr = 0; | ||
| 726 | __cpu_logical_map[0] = stap(); | ||
| 727 | } | ||
| 728 | |||
| 720 | /* | 729 | /* |
| 721 | * the frequency of the profiling timer can be changed | 730 | * the frequency of the profiling timer can be changed |
| 722 | * by writing a multiplier value into /proc/profile. | 731 | * by writing a multiplier value into /proc/profile. |
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index 4f292c936872..30eca070d426 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
| @@ -340,4 +340,3 @@ SYSCALL(sys_preadv,sys_preadv,compat_sys_preadv_wrapper) | |||
| 340 | SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper) | 340 | SYSCALL(sys_pwritev,sys_pwritev,compat_sys_pwritev_wrapper) |
| 341 | SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */ | 341 | SYSCALL(sys_rt_tgsigqueueinfo,sys_rt_tgsigqueueinfo,compat_sys_rt_tgsigqueueinfo_wrapper) /* 330 */ |
| 342 | SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper) | 342 | SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper) |
| 343 | SYSCALL(sys_recvmmsg,sys_recvmmsg,compat_sys_recvmmsg_wrapper) | ||
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index 3c72c9cf22b6..14ef6f05e432 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c | |||
| @@ -114,7 +114,7 @@ static void add_cpus_to_core(struct tl_cpu *tl_cpu, struct core_info *core) | |||
| 114 | 114 | ||
| 115 | rcpu = CPU_BITS - 1 - cpu + tl_cpu->origin; | 115 | rcpu = CPU_BITS - 1 - cpu + tl_cpu->origin; |
| 116 | for_each_present_cpu(lcpu) { | 116 | for_each_present_cpu(lcpu) { |
| 117 | if (__cpu_logical_map[lcpu] == rcpu) { | 117 | if (cpu_logical_map(lcpu) == rcpu) { |
| 118 | cpu_set(lcpu, core->mask); | 118 | cpu_set(lcpu, core->mask); |
| 119 | smp_cpu_polarization[lcpu] = tl_cpu->pp; | 119 | smp_cpu_polarization[lcpu] = tl_cpu->pp; |
| 120 | } | 120 | } |
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c index 10754a375668..cff327f109a8 100644 --- a/arch/s390/lib/spinlock.c +++ b/arch/s390/lib/spinlock.c | |||
| @@ -34,7 +34,7 @@ static inline void _raw_yield_cpu(int cpu) | |||
| 34 | { | 34 | { |
| 35 | if (MACHINE_HAS_DIAG9C) | 35 | if (MACHINE_HAS_DIAG9C) |
| 36 | asm volatile("diag %0,0,0x9c" | 36 | asm volatile("diag %0,0,0x9c" |
| 37 | : : "d" (__cpu_logical_map[cpu])); | 37 | : : "d" (cpu_logical_map(cpu))); |
| 38 | else | 38 | else |
| 39 | _raw_yield(); | 39 | _raw_yield(); |
| 40 | } | 40 | } |
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c index f4558ccf02b9..869efbaed3ea 100644 --- a/arch/s390/mm/mmap.c +++ b/arch/s390/mm/mmap.c | |||
| @@ -40,7 +40,7 @@ | |||
| 40 | 40 | ||
| 41 | static inline unsigned long mmap_base(void) | 41 | static inline unsigned long mmap_base(void) |
| 42 | { | 42 | { |
| 43 | unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur; | 43 | unsigned long gap = rlimit(RLIMIT_STACK); |
| 44 | 44 | ||
| 45 | if (gap < MIN_GAP) | 45 | if (gap < MIN_GAP) |
| 46 | gap = MIN_GAP; | 46 | gap = MIN_GAP; |
| @@ -61,7 +61,7 @@ static inline int mmap_is_legacy(void) | |||
| 61 | #endif | 61 | #endif |
| 62 | return sysctl_legacy_va_layout || | 62 | return sysctl_legacy_va_layout || |
| 63 | (current->personality & ADDR_COMPAT_LAYOUT) || | 63 | (current->personality & ADDR_COMPAT_LAYOUT) || |
| 64 | current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY; | 64 | rlimit(RLIMIT_STACK) == RLIM_INFINITY; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | #ifndef CONFIG_64BIT | 67 | #ifndef CONFIG_64BIT |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 5819dc02a143..1c500c462225 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <asm/debug.h> | 23 | #include <asm/debug.h> |
| 24 | #include <asm/idals.h> | 24 | #include <asm/idals.h> |
| 25 | #include <asm/ebcdic.h> | 25 | #include <asm/ebcdic.h> |
| 26 | #include <asm/compat.h> | ||
| 26 | #include <asm/io.h> | 27 | #include <asm/io.h> |
| 27 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
| 28 | #include <asm/cio.h> | 29 | #include <asm/cio.h> |
| @@ -2844,13 +2845,16 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp) | |||
| 2844 | rc = -EFAULT; | 2845 | rc = -EFAULT; |
| 2845 | if (copy_from_user(&usrparm, argp, sizeof(usrparm))) | 2846 | if (copy_from_user(&usrparm, argp, sizeof(usrparm))) |
| 2846 | goto out; | 2847 | goto out; |
| 2847 | #ifndef CONFIG_64BIT | 2848 | if (is_compat_task() || sizeof(long) == 4) { |
| 2848 | /* Make sure pointers are sane even on 31 bit. */ | 2849 | /* Make sure pointers are sane even on 31 bit. */ |
| 2849 | if ((usrparm.psf_data >> 32) != 0 || (usrparm.rssd_result >> 32) != 0) { | ||
| 2850 | rc = -EINVAL; | 2850 | rc = -EINVAL; |
| 2851 | goto out; | 2851 | if ((usrparm.psf_data >> 32) != 0) |
| 2852 | goto out; | ||
| 2853 | if ((usrparm.rssd_result >> 32) != 0) | ||
| 2854 | goto out; | ||
| 2855 | usrparm.psf_data &= 0x7fffffffULL; | ||
| 2856 | usrparm.rssd_result &= 0x7fffffffULL; | ||
| 2852 | } | 2857 | } |
| 2853 | #endif | ||
| 2854 | /* alloc I/O data area */ | 2858 | /* alloc I/O data area */ |
| 2855 | psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA); | 2859 | psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA); |
| 2856 | rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA); | 2860 | rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA); |
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 478bcdb90b6f..fc7b30b4a255 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
| 18 | #include <linux/blkpg.h> | 18 | #include <linux/blkpg.h> |
| 19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
| 20 | 20 | #include <asm/compat.h> | |
| 21 | #include <asm/ccwdev.h> | 21 | #include <asm/ccwdev.h> |
| 22 | #include <asm/cmb.h> | 22 | #include <asm/cmb.h> |
| 23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
| @@ -358,9 +358,8 @@ dasd_ioctl_set_ro(struct block_device *bdev, void __user *argp) | |||
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | static int dasd_ioctl_readall_cmb(struct dasd_block *block, unsigned int cmd, | 360 | static int dasd_ioctl_readall_cmb(struct dasd_block *block, unsigned int cmd, |
| 361 | unsigned long arg) | 361 | struct cmbdata __user *argp) |
| 362 | { | 362 | { |
| 363 | struct cmbdata __user *argp = (void __user *) arg; | ||
| 364 | size_t size = _IOC_SIZE(cmd); | 363 | size_t size = _IOC_SIZE(cmd); |
| 365 | struct cmbdata data; | 364 | struct cmbdata data; |
| 366 | int ret; | 365 | int ret; |
| @@ -376,7 +375,12 @@ dasd_do_ioctl(struct block_device *bdev, fmode_t mode, | |||
| 376 | unsigned int cmd, unsigned long arg) | 375 | unsigned int cmd, unsigned long arg) |
| 377 | { | 376 | { |
| 378 | struct dasd_block *block = bdev->bd_disk->private_data; | 377 | struct dasd_block *block = bdev->bd_disk->private_data; |
| 379 | void __user *argp = (void __user *)arg; | 378 | void __user *argp; |
| 379 | |||
| 380 | if (is_compat_task()) | ||
| 381 | argp = compat_ptr(arg); | ||
| 382 | else | ||
| 383 | argp = (void __user *)arg; | ||
| 380 | 384 | ||
| 381 | if (!block) | 385 | if (!block) |
| 382 | return -ENODEV; | 386 | return -ENODEV; |
| @@ -414,7 +418,7 @@ dasd_do_ioctl(struct block_device *bdev, fmode_t mode, | |||
| 414 | case BIODASDCMFDISABLE: | 418 | case BIODASDCMFDISABLE: |
| 415 | return disable_cmf(block->base->cdev); | 419 | return disable_cmf(block->base->cdev); |
| 416 | case BIODASDREADALLCMB: | 420 | case BIODASDREADALLCMB: |
| 417 | return dasd_ioctl_readall_cmb(block, cmd, arg); | 421 | return dasd_ioctl_readall_cmb(block, cmd, argp); |
| 418 | default: | 422 | default: |
| 419 | /* if the discipline has an ioctl method try it. */ | 423 | /* if the discipline has an ioctl method try it. */ |
| 420 | if (block->base->discipline->ioctl) { | 424 | if (block->base->discipline->ioctl) { |
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 9d61683b5633..59ec073724bf 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c | |||
| @@ -1037,22 +1037,6 @@ static void tty3215_flush_buffer(struct tty_struct *tty) | |||
| 1037 | } | 1037 | } |
| 1038 | 1038 | ||
| 1039 | /* | 1039 | /* |
| 1040 | * Currently we don't have any io controls for 3215 ttys | ||
| 1041 | */ | ||
| 1042 | static int tty3215_ioctl(struct tty_struct *tty, struct file * file, | ||
| 1043 | unsigned int cmd, unsigned long arg) | ||
| 1044 | { | ||
| 1045 | if (tty->flags & (1 << TTY_IO_ERROR)) | ||
| 1046 | return -EIO; | ||
| 1047 | |||
| 1048 | switch (cmd) { | ||
| 1049 | default: | ||
| 1050 | return -ENOIOCTLCMD; | ||
| 1051 | } | ||
| 1052 | return 0; | ||
| 1053 | } | ||
| 1054 | |||
| 1055 | /* | ||
| 1056 | * Disable reading from a 3215 tty | 1040 | * Disable reading from a 3215 tty |
| 1057 | */ | 1041 | */ |
| 1058 | static void tty3215_throttle(struct tty_struct * tty) | 1042 | static void tty3215_throttle(struct tty_struct * tty) |
| @@ -1117,7 +1101,6 @@ static const struct tty_operations tty3215_ops = { | |||
| 1117 | .write_room = tty3215_write_room, | 1101 | .write_room = tty3215_write_room, |
| 1118 | .chars_in_buffer = tty3215_chars_in_buffer, | 1102 | .chars_in_buffer = tty3215_chars_in_buffer, |
| 1119 | .flush_buffer = tty3215_flush_buffer, | 1103 | .flush_buffer = tty3215_flush_buffer, |
| 1120 | .ioctl = tty3215_ioctl, | ||
| 1121 | .throttle = tty3215_throttle, | 1104 | .throttle = tty3215_throttle, |
| 1122 | .unthrottle = tty3215_unthrottle, | 1105 | .unthrottle = tty3215_unthrottle, |
| 1123 | .stop = tty3215_stop, | 1106 | .stop = tty3215_stop, |
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c index 247b2b934728..31c59b0d6df0 100644 --- a/drivers/s390/char/fs3270.c +++ b/drivers/s390/char/fs3270.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
| 16 | #include <linux/smp_lock.h> | 16 | #include <linux/smp_lock.h> |
| 17 | 17 | ||
| 18 | #include <asm/compat.h> | ||
| 18 | #include <asm/ccwdev.h> | 19 | #include <asm/ccwdev.h> |
| 19 | #include <asm/cio.h> | 20 | #include <asm/cio.h> |
| 20 | #include <asm/ebcdic.h> | 21 | #include <asm/ebcdic.h> |
| @@ -322,6 +323,7 @@ fs3270_write(struct file *filp, const char __user *data, size_t count, loff_t *o | |||
| 322 | static long | 323 | static long |
| 323 | fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 324 | fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
| 324 | { | 325 | { |
| 326 | char __user *argp; | ||
| 325 | struct fs3270 *fp; | 327 | struct fs3270 *fp; |
| 326 | struct raw3270_iocb iocb; | 328 | struct raw3270_iocb iocb; |
| 327 | int rc; | 329 | int rc; |
| @@ -329,6 +331,10 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 329 | fp = filp->private_data; | 331 | fp = filp->private_data; |
| 330 | if (!fp) | 332 | if (!fp) |
| 331 | return -ENODEV; | 333 | return -ENODEV; |
| 334 | if (is_compat_task()) | ||
| 335 | argp = compat_ptr(arg); | ||
| 336 | else | ||
| 337 | argp = (char __user *)arg; | ||
| 332 | rc = 0; | 338 | rc = 0; |
| 333 | mutex_lock(&fs3270_mutex); | 339 | mutex_lock(&fs3270_mutex); |
| 334 | switch (cmd) { | 340 | switch (cmd) { |
| @@ -339,10 +345,10 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 339 | fp->write_command = arg; | 345 | fp->write_command = arg; |
| 340 | break; | 346 | break; |
| 341 | case TUBGETI: | 347 | case TUBGETI: |
| 342 | rc = put_user(fp->read_command, (char __user *) arg); | 348 | rc = put_user(fp->read_command, argp); |
| 343 | break; | 349 | break; |
| 344 | case TUBGETO: | 350 | case TUBGETO: |
| 345 | rc = put_user(fp->write_command,(char __user *) arg); | 351 | rc = put_user(fp->write_command, argp); |
| 346 | break; | 352 | break; |
| 347 | case TUBGETMOD: | 353 | case TUBGETMOD: |
| 348 | iocb.model = fp->view.model; | 354 | iocb.model = fp->view.model; |
| @@ -351,8 +357,7 @@ fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
| 351 | iocb.pf_cnt = 24; | 357 | iocb.pf_cnt = 24; |
| 352 | iocb.re_cnt = 20; | 358 | iocb.re_cnt = 20; |
| 353 | iocb.map = 0; | 359 | iocb.map = 0; |
| 354 | if (copy_to_user((char __user *) arg, &iocb, | 360 | if (copy_to_user(argp, &iocb, sizeof(struct raw3270_iocb))) |
| 355 | sizeof(struct raw3270_iocb))) | ||
| 356 | rc = -EFAULT; | 361 | rc = -EFAULT; |
| 357 | break; | 362 | break; |
| 358 | } | 363 | } |
| @@ -511,8 +516,8 @@ static const struct file_operations fs3270_fops = { | |||
| 511 | .write = fs3270_write, /* write */ | 516 | .write = fs3270_write, /* write */ |
| 512 | .unlocked_ioctl = fs3270_ioctl, /* ioctl */ | 517 | .unlocked_ioctl = fs3270_ioctl, /* ioctl */ |
| 513 | .compat_ioctl = fs3270_ioctl, /* ioctl */ | 518 | .compat_ioctl = fs3270_ioctl, /* ioctl */ |
| 514 | .open = fs3270_open, /* open */ | 519 | .open = fs3270_open, /* open */ |
| 515 | .release = fs3270_close, /* release */ | 520 | .release = fs3270_close, /* release */ |
| 516 | }; | 521 | }; |
| 517 | 522 | ||
| 518 | /* | 523 | /* |
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index 96816149368a..8d3d720737da 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
| @@ -46,8 +46,6 @@ | |||
| 46 | */ | 46 | */ |
| 47 | static int tapeblock_open(struct block_device *, fmode_t); | 47 | static int tapeblock_open(struct block_device *, fmode_t); |
| 48 | static int tapeblock_release(struct gendisk *, fmode_t); | 48 | static int tapeblock_release(struct gendisk *, fmode_t); |
| 49 | static int tapeblock_ioctl(struct block_device *, fmode_t, unsigned int, | ||
| 50 | unsigned long); | ||
| 51 | static int tapeblock_medium_changed(struct gendisk *); | 49 | static int tapeblock_medium_changed(struct gendisk *); |
| 52 | static int tapeblock_revalidate_disk(struct gendisk *); | 50 | static int tapeblock_revalidate_disk(struct gendisk *); |
| 53 | 51 | ||
| @@ -55,7 +53,6 @@ static const struct block_device_operations tapeblock_fops = { | |||
| 55 | .owner = THIS_MODULE, | 53 | .owner = THIS_MODULE, |
| 56 | .open = tapeblock_open, | 54 | .open = tapeblock_open, |
| 57 | .release = tapeblock_release, | 55 | .release = tapeblock_release, |
| 58 | .ioctl = tapeblock_ioctl, | ||
| 59 | .media_changed = tapeblock_medium_changed, | 56 | .media_changed = tapeblock_medium_changed, |
| 60 | .revalidate_disk = tapeblock_revalidate_disk, | 57 | .revalidate_disk = tapeblock_revalidate_disk, |
| 61 | }; | 58 | }; |
| @@ -416,42 +413,6 @@ tapeblock_release(struct gendisk *disk, fmode_t mode) | |||
| 416 | } | 413 | } |
| 417 | 414 | ||
| 418 | /* | 415 | /* |
| 419 | * Support of some generic block device IOCTLs. | ||
| 420 | */ | ||
| 421 | static int | ||
| 422 | tapeblock_ioctl( | ||
| 423 | struct block_device * bdev, | ||
| 424 | fmode_t mode, | ||
| 425 | unsigned int command, | ||
| 426 | unsigned long arg | ||
| 427 | ) { | ||
| 428 | int rc; | ||
| 429 | int minor; | ||
| 430 | struct gendisk *disk = bdev->bd_disk; | ||
| 431 | struct tape_device *device; | ||
| 432 | |||
| 433 | rc = 0; | ||
| 434 | BUG_ON(!disk); | ||
| 435 | device = disk->private_data; | ||
| 436 | BUG_ON(!device); | ||
| 437 | minor = MINOR(bdev->bd_dev); | ||
| 438 | |||
| 439 | DBF_LH(6, "tapeblock_ioctl(0x%0x)\n", command); | ||
| 440 | DBF_LH(6, "device = %d:%d\n", tapeblock_major, minor); | ||
| 441 | |||
| 442 | switch (command) { | ||
| 443 | /* Refuse some IOCTL calls without complaining (mount). */ | ||
| 444 | case 0x5310: /* CDROMMULTISESSION */ | ||
| 445 | rc = -EINVAL; | ||
| 446 | break; | ||
| 447 | default: | ||
| 448 | rc = -EINVAL; | ||
| 449 | } | ||
| 450 | |||
| 451 | return rc; | ||
| 452 | } | ||
| 453 | |||
| 454 | /* | ||
| 455 | * Initialize block device frontend. | 416 | * Initialize block device frontend. |
| 456 | */ | 417 | */ |
| 457 | int | 418 | int |
diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index 2125ec7d95f0..539045acaad4 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/proc_fs.h> | 18 | #include <linux/proc_fs.h> |
| 19 | #include <linux/mtio.h> | 19 | #include <linux/mtio.h> |
| 20 | #include <linux/smp_lock.h> | 20 | #include <linux/smp_lock.h> |
| 21 | #include <linux/compat.h> | ||
| 21 | 22 | ||
| 22 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
| 23 | 24 | ||
| @@ -37,8 +38,9 @@ static ssize_t tapechar_write(struct file *, const char __user *, size_t, loff_t | |||
| 37 | static int tapechar_open(struct inode *,struct file *); | 38 | static int tapechar_open(struct inode *,struct file *); |
| 38 | static int tapechar_release(struct inode *,struct file *); | 39 | static int tapechar_release(struct inode *,struct file *); |
| 39 | static long tapechar_ioctl(struct file *, unsigned int, unsigned long); | 40 | static long tapechar_ioctl(struct file *, unsigned int, unsigned long); |
| 40 | static long tapechar_compat_ioctl(struct file *, unsigned int, | 41 | #ifdef CONFIG_COMPAT |
| 41 | unsigned long); | 42 | static long tapechar_compat_ioctl(struct file *, unsigned int, unsigned long); |
| 43 | #endif | ||
| 42 | 44 | ||
| 43 | static const struct file_operations tape_fops = | 45 | static const struct file_operations tape_fops = |
| 44 | { | 46 | { |
| @@ -46,7 +48,9 @@ static const struct file_operations tape_fops = | |||
| 46 | .read = tapechar_read, | 48 | .read = tapechar_read, |
| 47 | .write = tapechar_write, | 49 | .write = tapechar_write, |
| 48 | .unlocked_ioctl = tapechar_ioctl, | 50 | .unlocked_ioctl = tapechar_ioctl, |
| 51 | #ifdef CONFIG_COMPAT | ||
| 49 | .compat_ioctl = tapechar_compat_ioctl, | 52 | .compat_ioctl = tapechar_compat_ioctl, |
| 53 | #endif | ||
| 50 | .open = tapechar_open, | 54 | .open = tapechar_open, |
| 51 | .release = tapechar_release, | 55 | .release = tapechar_release, |
| 52 | }; | 56 | }; |
| @@ -457,15 +461,22 @@ tapechar_ioctl(struct file *filp, unsigned int no, unsigned long data) | |||
| 457 | return rc; | 461 | return rc; |
| 458 | } | 462 | } |
| 459 | 463 | ||
| 464 | #ifdef CONFIG_COMPAT | ||
| 460 | static long | 465 | static long |
| 461 | tapechar_compat_ioctl(struct file *filp, unsigned int no, unsigned long data) | 466 | tapechar_compat_ioctl(struct file *filp, unsigned int no, unsigned long data) |
| 462 | { | 467 | { |
| 463 | struct tape_device *device = filp->private_data; | 468 | struct tape_device *device = filp->private_data; |
| 464 | int rval = -ENOIOCTLCMD; | 469 | int rval = -ENOIOCTLCMD; |
| 470 | unsigned long argp; | ||
| 465 | 471 | ||
| 472 | /* The 'arg' argument of any ioctl function may only be used for | ||
| 473 | * pointers because of the compat pointer conversion. | ||
| 474 | * Consider this when adding new ioctls. | ||
| 475 | */ | ||
| 476 | argp = (unsigned long) compat_ptr(data); | ||
| 466 | if (device->discipline->ioctl_fn) { | 477 | if (device->discipline->ioctl_fn) { |
| 467 | mutex_lock(&device->mutex); | 478 | mutex_lock(&device->mutex); |
| 468 | rval = device->discipline->ioctl_fn(device, no, data); | 479 | rval = device->discipline->ioctl_fn(device, no, argp); |
| 469 | mutex_unlock(&device->mutex); | 480 | mutex_unlock(&device->mutex); |
| 470 | if (rval == -EINVAL) | 481 | if (rval == -EINVAL) |
| 471 | rval = -ENOIOCTLCMD; | 482 | rval = -ENOIOCTLCMD; |
| @@ -473,6 +484,7 @@ tapechar_compat_ioctl(struct file *filp, unsigned int no, unsigned long data) | |||
| 473 | 484 | ||
| 474 | return rval; | 485 | return rval; |
| 475 | } | 486 | } |
| 487 | #endif /* CONFIG_COMPAT */ | ||
| 476 | 488 | ||
| 477 | /* | 489 | /* |
| 478 | * Initialize character device frontend. | 490 | * Initialize character device frontend. |
diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c index a6087cec55b4..921dcda77676 100644 --- a/drivers/s390/char/vmcp.c +++ b/drivers/s390/char/vmcp.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
| 20 | #include <linux/miscdevice.h> | 20 | #include <linux/miscdevice.h> |
| 21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
| 22 | #include <asm/compat.h> | ||
| 22 | #include <asm/cpcmd.h> | 23 | #include <asm/cpcmd.h> |
| 23 | #include <asm/debug.h> | 24 | #include <asm/debug.h> |
| 24 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
| @@ -139,21 +140,26 @@ vmcp_write(struct file *file, const char __user *buff, size_t count, | |||
| 139 | static long vmcp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 140 | static long vmcp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
| 140 | { | 141 | { |
| 141 | struct vmcp_session *session; | 142 | struct vmcp_session *session; |
| 143 | int __user *argp; | ||
| 142 | int temp; | 144 | int temp; |
| 143 | 145 | ||
| 144 | session = (struct vmcp_session *)file->private_data; | 146 | session = (struct vmcp_session *)file->private_data; |
| 147 | if (is_compat_task()) | ||
| 148 | argp = compat_ptr(arg); | ||
| 149 | else | ||
| 150 | argp = (int __user *)arg; | ||
| 145 | if (mutex_lock_interruptible(&session->mutex)) | 151 | if (mutex_lock_interruptible(&session->mutex)) |
| 146 | return -ERESTARTSYS; | 152 | return -ERESTARTSYS; |
| 147 | switch (cmd) { | 153 | switch (cmd) { |
| 148 | case VMCP_GETCODE: | 154 | case VMCP_GETCODE: |
| 149 | temp = session->resp_code; | 155 | temp = session->resp_code; |
| 150 | mutex_unlock(&session->mutex); | 156 | mutex_unlock(&session->mutex); |
| 151 | return put_user(temp, (int __user *)arg); | 157 | return put_user(temp, argp); |
| 152 | case VMCP_SETBUF: | 158 | case VMCP_SETBUF: |
| 153 | free_pages((unsigned long)session->response, | 159 | free_pages((unsigned long)session->response, |
| 154 | get_order(session->bufsize)); | 160 | get_order(session->bufsize)); |
| 155 | session->response=NULL; | 161 | session->response=NULL; |
| 156 | temp = get_user(session->bufsize, (int __user *)arg); | 162 | temp = get_user(session->bufsize, argp); |
| 157 | if (get_order(session->bufsize) > 8) { | 163 | if (get_order(session->bufsize) > 8) { |
| 158 | session->bufsize = PAGE_SIZE; | 164 | session->bufsize = PAGE_SIZE; |
| 159 | temp = -EINVAL; | 165 | temp = -EINVAL; |
| @@ -163,7 +169,7 @@ static long vmcp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 163 | case VMCP_GETSIZE: | 169 | case VMCP_GETSIZE: |
| 164 | temp = session->resp_size; | 170 | temp = session->resp_size; |
| 165 | mutex_unlock(&session->mutex); | 171 | mutex_unlock(&session->mutex); |
| 166 | return put_user(temp, (int __user *)arg); | 172 | return put_user(temp, argp); |
| 167 | default: | 173 | default: |
| 168 | mutex_unlock(&session->mutex); | 174 | mutex_unlock(&session->mutex); |
| 169 | return -ENOIOCTLCMD; | 175 | return -ENOIOCTLCMD; |
diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c index cc5144b6f9d9..c84ac9443079 100644 --- a/drivers/s390/cio/chsc_sch.c +++ b/drivers/s390/cio/chsc_sch.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include <linux/uaccess.h> | 12 | #include <linux/uaccess.h> |
| 13 | #include <linux/miscdevice.h> | 13 | #include <linux/miscdevice.h> |
| 14 | 14 | ||
| 15 | #include <asm/compat.h> | ||
| 15 | #include <asm/cio.h> | 16 | #include <asm/cio.h> |
| 16 | #include <asm/chsc.h> | 17 | #include <asm/chsc.h> |
| 17 | #include <asm/isc.h> | 18 | #include <asm/isc.h> |
| @@ -770,24 +771,30 @@ out_free: | |||
| 770 | static long chsc_ioctl(struct file *filp, unsigned int cmd, | 771 | static long chsc_ioctl(struct file *filp, unsigned int cmd, |
| 771 | unsigned long arg) | 772 | unsigned long arg) |
| 772 | { | 773 | { |
| 774 | void __user *argp; | ||
| 775 | |||
| 773 | CHSC_MSG(2, "chsc_ioctl called, cmd=%x\n", cmd); | 776 | CHSC_MSG(2, "chsc_ioctl called, cmd=%x\n", cmd); |
| 777 | if (is_compat_task()) | ||
| 778 | argp = compat_ptr(arg); | ||
| 779 | else | ||
| 780 | argp = (void __user *)arg; | ||
| 774 | switch (cmd) { | 781 | switch (cmd) { |
| 775 | case CHSC_START: | 782 | case CHSC_START: |
| 776 | return chsc_ioctl_start((void __user *)arg); | 783 | return chsc_ioctl_start(argp); |
| 777 | case CHSC_INFO_CHANNEL_PATH: | 784 | case CHSC_INFO_CHANNEL_PATH: |
| 778 | return chsc_ioctl_info_channel_path((void __user *)arg); | 785 | return chsc_ioctl_info_channel_path(argp); |
| 779 | case CHSC_INFO_CU: | 786 | case CHSC_INFO_CU: |
| 780 | return chsc_ioctl_info_cu((void __user *)arg); | 787 | return chsc_ioctl_info_cu(argp); |
| 781 | case CHSC_INFO_SCH_CU: | 788 | case CHSC_INFO_SCH_CU: |
| 782 | return chsc_ioctl_info_sch_cu((void __user *)arg); | 789 | return chsc_ioctl_info_sch_cu(argp); |
| 783 | case CHSC_INFO_CI: | 790 | case CHSC_INFO_CI: |
| 784 | return chsc_ioctl_conf_info((void __user *)arg); | 791 | return chsc_ioctl_conf_info(argp); |
| 785 | case CHSC_INFO_CCL: | 792 | case CHSC_INFO_CCL: |
| 786 | return chsc_ioctl_conf_comp_list((void __user *)arg); | 793 | return chsc_ioctl_conf_comp_list(argp); |
| 787 | case CHSC_INFO_CPD: | 794 | case CHSC_INFO_CPD: |
| 788 | return chsc_ioctl_chpd((void __user *)arg); | 795 | return chsc_ioctl_chpd(argp); |
| 789 | case CHSC_INFO_DCAL: | 796 | case CHSC_INFO_DCAL: |
| 790 | return chsc_ioctl_dcal((void __user *)arg); | 797 | return chsc_ioctl_dcal(argp); |
| 791 | default: /* unknown ioctl number */ | 798 | default: /* unknown ioctl number */ |
| 792 | return -ENOIOCTLCMD; | 799 | return -ENOIOCTLCMD; |
| 793 | } | 800 | } |
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 0d4d18bdd45c..c68be24e27d9 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c | |||
| @@ -393,10 +393,12 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt) | |||
| 393 | * u_mult_inv > 128 bytes. | 393 | * u_mult_inv > 128 bytes. |
| 394 | */ | 394 | */ |
| 395 | if (copied == 0) { | 395 | if (copied == 0) { |
| 396 | int len; | 396 | unsigned int len; |
| 397 | spin_unlock_bh(&zcrypt_device_lock); | 397 | spin_unlock_bh(&zcrypt_device_lock); |
| 398 | /* len is max 256 / 2 - 120 = 8 */ | 398 | /* len is max 256 / 2 - 120 = 8 */ |
| 399 | len = crt->inputdatalength / 2 - 120; | 399 | len = crt->inputdatalength / 2 - 120; |
| 400 | if (len > sizeof(z1)) | ||
| 401 | return -EFAULT; | ||
| 400 | z1 = z2 = z3 = 0; | 402 | z1 = z2 = z3 = 0; |
| 401 | if (copy_from_user(&z1, crt->np_prime, len) || | 403 | if (copy_from_user(&z1, crt->np_prime, len) || |
| 402 | copy_from_user(&z2, crt->bp_key, len) || | 404 | copy_from_user(&z2, crt->bp_key, len) || |
