aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2013-02-19 14:47:37 -0500
committerHelge Deller <deller@gmx.de>2013-02-20 16:56:50 -0500
commitbf581e15a443fa3569d9def96b512315ba509d6f (patch)
tree248e7bce3b05c4867d33df9f96d844a78a03e654 /arch/parisc/kernel
parentfee707b459da56ba83fbb4ae89151571502ee724 (diff)
parisc: convert msgrcv and msgsnd syscalls to use compat layer
Switch over to use the existing compat_* implementation for msgrcv() and msgsnd(). Existing code was even partly buggy since it returned on some paths different error codes than the standard. Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch/parisc/kernel')
-rw-r--r--arch/parisc/kernel/sys_parisc32.c58
-rw-r--r--arch/parisc/kernel/syscall_table.S4
2 files changed, 2 insertions, 60 deletions
diff --git a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
index 9cfdaa19ab63..cee60f77fc1f 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -21,7 +21,6 @@
21#include <linux/time.h> 21#include <linux/time.h>
22#include <linux/smp.h> 22#include <linux/smp.h>
23#include <linux/sem.h> 23#include <linux/sem.h>
24#include <linux/msg.h>
25#include <linux/shm.h> 24#include <linux/shm.h>
26#include <linux/slab.h> 25#include <linux/slab.h>
27#include <linux/uio.h> 26#include <linux/uio.h>
@@ -73,63 +72,6 @@ asmlinkage long sys32_sched_rr_get_interval(pid_t pid,
73 return ret; 72 return ret;
74} 73}
75 74
76struct msgbuf32 {
77 int mtype;
78 char mtext[1];
79};
80
81asmlinkage long sys32_msgsnd(int msqid,
82 struct msgbuf32 __user *umsgp32,
83 size_t msgsz, int msgflg)
84{
85 struct msgbuf *mb;
86 struct msgbuf32 mb32;
87 int err;
88
89 if ((mb = kmalloc(msgsz + sizeof *mb + 4, GFP_KERNEL)) == NULL)
90 return -ENOMEM;
91
92 err = get_user(mb32.mtype, &umsgp32->mtype);
93 mb->mtype = mb32.mtype;
94 err |= copy_from_user(mb->mtext, &umsgp32->mtext, msgsz);
95
96 if (err)
97 err = -EFAULT;
98 else
99 KERNEL_SYSCALL(err, sys_msgsnd, msqid, (struct msgbuf __user *)mb, msgsz, msgflg);
100
101 kfree(mb);
102 return err;
103}
104
105asmlinkage long sys32_msgrcv(int msqid,
106 struct msgbuf32 __user *umsgp32,
107 size_t msgsz, long msgtyp, int msgflg)
108{
109 struct msgbuf *mb;
110 struct msgbuf32 mb32;
111 int err, len;
112
113 if ((mb = kmalloc(msgsz + sizeof *mb + 4, GFP_KERNEL)) == NULL)
114 return -ENOMEM;
115
116 KERNEL_SYSCALL(err, sys_msgrcv, msqid, (struct msgbuf __user *)mb, msgsz, msgtyp, msgflg);
117
118 if (err >= 0) {
119 len = err;
120 mb32.mtype = mb->mtype;
121 err = put_user(mb32.mtype, &umsgp32->mtype);
122 err |= copy_to_user(&umsgp32->mtext, mb->mtext, len);
123 if (err)
124 err = -EFAULT;
125 else
126 err = len;
127 }
128
129 kfree(mb);
130 return err;
131}
132
133asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count) 75asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
134{ 76{
135 mm_segment_t old_fs = get_fs(); 77 mm_segment_t old_fs = get_fs();
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index e5fcd4c605e2..773b4ee1e1d3 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -286,8 +286,8 @@
286 ENTRY_SAME(semop) /* 185 */ 286 ENTRY_SAME(semop) /* 185 */
287 ENTRY_SAME(semget) 287 ENTRY_SAME(semget)
288 ENTRY_DIFF(semctl) 288 ENTRY_DIFF(semctl)
289 ENTRY_DIFF(msgsnd) 289 ENTRY_COMP(msgsnd)
290 ENTRY_DIFF(msgrcv) 290 ENTRY_COMP(msgrcv)
291 ENTRY_SAME(msgget) /* 190 */ 291 ENTRY_SAME(msgget) /* 190 */
292 ENTRY_SAME(msgctl) 292 ENTRY_SAME(msgctl)
293 ENTRY_SAME(shmat) 293 ENTRY_SAME(shmat)