Commit 282312b0 authored by David S. Miller's avatar David S. Miller

Merge nuts.ninka.net:/home/davem/src/BK/sparcwork-2.5

into nuts.ninka.net:/home/davem/src/BK/sparc-2.5
parents 51544df2 c79a3654
...@@ -123,7 +123,10 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user ...@@ -123,7 +123,10 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user
if (call <= SEMCTL) if (call <= SEMCTL)
switch (call) { switch (call) {
case SEMOP: case SEMOP:
err = sys_semop (first, (struct sembuf __user *)ptr, second); err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
goto out;
case SEMTIMEDOP:
err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, (const struct timespec __user *) fifth);
goto out; goto out;
case SEMGET: case SEMGET:
err = sys_semget (first, second, third); err = sys_semget (first, second, third);
......
...@@ -182,7 +182,10 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir ...@@ -182,7 +182,10 @@ asmlinkage int sys_ipc (unsigned call, int first, int second, unsigned long thir
if (call <= SEMCTL) if (call <= SEMCTL)
switch (call) { switch (call) {
case SEMOP: case SEMOP:
err = sys_semop (first, (struct sembuf *)ptr, second); err = sys_semtimedop (first, (struct sembuf *)ptr, second, NULL);
goto out;
case SEMTIMEDOP:
err = sys_semtimedop (first, (struct sembuf *)ptr, second, (const struct timespec *) fifth);
goto out; goto out;
case SEMGET: case SEMGET:
err = sys_semget (first, second, (int)third); err = sys_semget (first, second, (int)third);
......
...@@ -480,7 +480,7 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr) ...@@ -480,7 +480,7 @@ static int do_sys32_semctl(int first, int second, int third, void *uptr)
static int do_sys32_msgsnd (int first, int second, int third, void *uptr) static int do_sys32_msgsnd (int first, int second, int third, void *uptr)
{ {
struct msgbuf *p = kmalloc (second + sizeof (struct msgbuf) + 4, GFP_USER); struct msgbuf *p = kmalloc (second + sizeof (struct msgbuf), GFP_USER);
struct msgbuf32 *up = (struct msgbuf32 *)uptr; struct msgbuf32 *up = (struct msgbuf32 *)uptr;
mm_segment_t old_fs; mm_segment_t old_fs;
int err; int err;
...@@ -522,12 +522,12 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third, ...@@ -522,12 +522,12 @@ static int do_sys32_msgrcv (int first, int second, int msgtyp, int third,
msgtyp = ipck.msgtyp; msgtyp = ipck.msgtyp;
} }
err = -ENOMEM; err = -ENOMEM;
p = kmalloc (second + sizeof (struct msgbuf) + 4, GFP_USER); p = kmalloc (second + sizeof (struct msgbuf), GFP_USER);
if (!p) if (!p)
goto out; goto out;
old_fs = get_fs (); old_fs = get_fs ();
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
err = sys_msgrcv (first, p, second + 4, msgtyp, third); err = sys_msgrcv (first, p, second, msgtyp, third);
set_fs (old_fs); set_fs (old_fs);
if (err < 0) if (err < 0)
goto free_then_out; goto free_then_out;
...@@ -736,6 +736,22 @@ static int do_sys32_shmctl (int first, int second, void *uptr) ...@@ -736,6 +736,22 @@ static int do_sys32_shmctl (int first, int second, void *uptr)
return err; return err;
} }
static int sys32_semtimedop(int semid, struct sembuf *tsems, int nsems,
const struct compat_timespec *timeout32)
{
struct compat_timespec t32;
struct timespec *t64 = compat_alloc_user_space(sizeof(*t64));
if (copy_from_user(&t32, timeout32, sizeof(t32)))
return -EFAULT;
if (put_user(t32.tv_sec, &t64->tv_sec) ||
put_user(t32.tv_nsec, &t64->tv_nsec))
return -EFAULT;
return sys_semtimedop(semid, tsems, nsems, t64);
}
asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth) asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
{ {
int version, err; int version, err;
...@@ -747,8 +763,10 @@ asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u ...@@ -747,8 +763,10 @@ asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u
switch (call) { switch (call) {
case SEMOP: case SEMOP:
/* struct sembuf is the same on 32 and 64bit :)) */ /* struct sembuf is the same on 32 and 64bit :)) */
err = sys_semop (first, (struct sembuf *)AA(ptr), second); err = sys_semtimedop (first, (struct sembuf *)AA(ptr), second, NULL);
goto out; goto out;
case SEMTIMEDOP:
err = sys32_semtimedop (first, (struct sembuf *)AA(ptr), second, (const struct compat_timespec *) AA(fifth));
case SEMGET: case SEMGET:
err = sys_semget (first, second, third); err = sys_semget (first, second, third);
goto out; goto out;
......
...@@ -14,6 +14,7 @@ struct ipc_kludge { ...@@ -14,6 +14,7 @@ struct ipc_kludge {
#define SEMOP 1 #define SEMOP 1
#define SEMGET 2 #define SEMGET 2
#define SEMCTL 3 #define SEMCTL 3
#define SEMTIMEDOP 4
#define MSGSND 11 #define MSGSND 11
#define MSGRCV 12 #define MSGRCV 12
#define MSGGET 13 #define MSGGET 13
......
...@@ -14,6 +14,7 @@ struct ipc_kludge { ...@@ -14,6 +14,7 @@ struct ipc_kludge {
#define SEMOP 1 #define SEMOP 1
#define SEMGET 2 #define SEMGET 2
#define SEMCTL 3 #define SEMCTL 3
#define SEMTIMEDOP 4
#define MSGSND 11 #define MSGSND 11
#define MSGRCV 12 #define MSGRCV 12
#define MSGGET 13 #define MSGGET 13
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment