Commit da5aad2e authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/davem/sparc-2.6

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents ee2b072a bbb644a2
...@@ -800,8 +800,8 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid) ...@@ -800,8 +800,8 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
} }
/* So stupid... */ /* So stupid... */
extern long compat_sys_wait4(compat_pid_t, compat_uint_t *, int, extern long compat_sys_wait4(compat_pid_t, compat_uint_t __user *, int,
struct compat_rusage *); struct compat_rusage __user *);
asmlinkage int sunos_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, struct compat_rusage __user *ru) asmlinkage int sunos_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, struct compat_rusage __user *ru)
{ {
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("addcc %4,%5,%1\n\ __asm__ ("addcc %4,%5,%1\n\t" \
add %2,%3,%0\n\ "add %2,%3,%0\n\t" \
bcs,a,pn %%xcc, 1f\n\ "bcs,a,pn %%xcc, 1f\n\t" \
add %0, 1, %0\n\ "add %0, 1, %0\n" \
1:" \ "1:" \
: "=r" ((UDItype)(sh)), \ : "=r" ((UDItype)(sh)), \
"=&r" ((UDItype)(sl)) \ "=&r" ((UDItype)(sl)) \
: "r" ((UDItype)(ah)), \ : "r" ((UDItype)(ah)), \
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
: "cc") : "cc")
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ #define sub_ddmmss(sh, sl, ah, al, bh, bl) \
__asm__ ("subcc %4,%5,%1\n\ __asm__ ("subcc %4,%5,%1\n\t" \
sub %2,%3,%0\n\ "sub %2,%3,%0\n\t" \
bcs,a,pn %%xcc, 1f\n\ "bcs,a,pn %%xcc, 1f\n\t" \
sub %0, 1, %0\n\ "sub %0, 1, %0\n" \
1:" \ "1:" \
: "=r" ((UDItype)(sh)), \ : "=r" ((UDItype)(sh)), \
"=&r" ((UDItype)(sl)) \ "=&r" ((UDItype)(sl)) \
: "r" ((UDItype)(ah)), \ : "r" ((UDItype)(ah)), \
...@@ -43,27 +43,27 @@ ...@@ -43,27 +43,27 @@
do { \ do { \
UDItype tmp1, tmp2, tmp3, tmp4; \ UDItype tmp1, tmp2, tmp3, tmp4; \
__asm__ __volatile__ ( \ __asm__ __volatile__ ( \
"srl %7,0,%3\n\ "srl %7,0,%3\n\t" \
mulx %3,%6,%1\n\ "mulx %3,%6,%1\n\t" \
srlx %6,32,%2\n\ "srlx %6,32,%2\n\t" \
mulx %2,%3,%4\n\ "mulx %2,%3,%4\n\t" \
sllx %4,32,%5\n\ "sllx %4,32,%5\n\t" \
srl %6,0,%3\n\ "srl %6,0,%3\n\t" \
sub %1,%5,%5\n\ "sub %1,%5,%5\n\t" \
srlx %5,32,%5\n\ "srlx %5,32,%5\n\t" \
addcc %4,%5,%4\n\ "addcc %4,%5,%4\n\t" \
srlx %7,32,%5\n\ "srlx %7,32,%5\n\t" \
mulx %3,%5,%3\n\ "mulx %3,%5,%3\n\t" \
mulx %2,%5,%5\n\ "mulx %2,%5,%5\n\t" \
sethi %%hi(0x80000000),%2\n\ "sethi %%hi(0x80000000),%2\n\t" \
addcc %4,%3,%4\n\ "addcc %4,%3,%4\n\t" \
srlx %4,32,%4\n\ "srlx %4,32,%4\n\t" \
add %2,%2,%2\n\ "add %2,%2,%2\n\t" \
movcc %%xcc,%%g0,%2\n\ "movcc %%xcc,%%g0,%2\n\t" \
addcc %5,%4,%5\n\ "addcc %5,%4,%5\n\t" \
sllx %3,32,%3\n\ "sllx %3,32,%3\n\t" \
add %1,%3,%1\n\ "add %1,%3,%1\n\t" \
add %5,%2,%0" \ "add %5,%2,%0" \
: "=r" ((UDItype)(wh)), \ : "=r" ((UDItype)(wh)), \
"=&r" ((UDItype)(wl)), \ "=&r" ((UDItype)(wl)), \
"=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \ "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4) \
......
...@@ -394,7 +394,7 @@ static struct kiocb fastcall *__aio_get_req(struct kioctx *ctx) ...@@ -394,7 +394,7 @@ static struct kiocb fastcall *__aio_get_req(struct kioctx *ctx)
req->ki_ctx = ctx; req->ki_ctx = ctx;
req->ki_cancel = NULL; req->ki_cancel = NULL;
req->ki_retry = NULL; req->ki_retry = NULL;
req->ki_user_obj = NULL; req->ki_obj.user = NULL;
/* Check if the completion queue has enough free space to /* Check if the completion queue has enough free space to
* accept an event from this io. * accept an event from this io.
...@@ -437,7 +437,7 @@ static inline void really_put_req(struct kioctx *ctx, struct kiocb *req) ...@@ -437,7 +437,7 @@ static inline void really_put_req(struct kioctx *ctx, struct kiocb *req)
{ {
req->ki_ctx = NULL; req->ki_ctx = NULL;
req->ki_filp = NULL; req->ki_filp = NULL;
req->ki_user_obj = NULL; req->ki_obj.user = NULL;
kmem_cache_free(kiocb_cachep, req); kmem_cache_free(kiocb_cachep, req);
ctx->reqs_active--; ctx->reqs_active--;
...@@ -605,7 +605,7 @@ void fastcall kick_iocb(struct kiocb *iocb) ...@@ -605,7 +605,7 @@ void fastcall kick_iocb(struct kiocb *iocb)
* single context. */ * single context. */
if (is_sync_kiocb(iocb)) { if (is_sync_kiocb(iocb)) {
kiocbSetKicked(iocb); kiocbSetKicked(iocb);
wake_up_process(iocb->ki_user_obj); wake_up_process(iocb->ki_obj.tsk);
return; return;
} }
...@@ -653,7 +653,7 @@ int fastcall aio_complete(struct kiocb *iocb, long res, long res2) ...@@ -653,7 +653,7 @@ int fastcall aio_complete(struct kiocb *iocb, long res, long res2)
spin_unlock_irq(&ctx->ctx_lock); spin_unlock_irq(&ctx->ctx_lock);
} }
/* sync iocbs put the task here for us */ /* sync iocbs put the task here for us */
wake_up_process(iocb->ki_user_obj); wake_up_process(iocb->ki_obj.tsk);
return ret; return ret;
} }
...@@ -673,13 +673,13 @@ int fastcall aio_complete(struct kiocb *iocb, long res, long res2) ...@@ -673,13 +673,13 @@ int fastcall aio_complete(struct kiocb *iocb, long res, long res2)
event = aio_ring_event(info, tail, KM_IRQ0); event = aio_ring_event(info, tail, KM_IRQ0);
tail = (tail + 1) % info->nr; tail = (tail + 1) % info->nr;
event->obj = (u64)(unsigned long)iocb->ki_user_obj; event->obj = (u64)(unsigned long)iocb->ki_obj.user;
event->data = iocb->ki_user_data; event->data = iocb->ki_user_data;
event->res = res; event->res = res;
event->res2 = res2; event->res2 = res2;
dprintk("aio_complete: %p[%lu]: %p: %p %Lx %lx %lx\n", dprintk("aio_complete: %p[%lu]: %p: %p %Lx %lx %lx\n",
ctx, tail, iocb, iocb->ki_user_obj, iocb->ki_user_data, ctx, tail, iocb, iocb->ki_obj.user, iocb->ki_user_data,
res, res2); res, res2);
/* after flagging the request as done, we /* after flagging the request as done, we
...@@ -1022,7 +1022,7 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, ...@@ -1022,7 +1022,7 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
goto out_put_req; goto out_put_req;
} }
req->ki_user_obj = user_iocb; req->ki_obj.user = user_iocb;
req->ki_user_data = iocb->aio_data; req->ki_user_data = iocb->aio_data;
req->ki_pos = iocb->aio_offset; req->ki_pos = iocb->aio_offset;
...@@ -1148,7 +1148,7 @@ struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb, u32 key ...@@ -1148,7 +1148,7 @@ struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb, u32 key
/* TODO: use a hash or array, this sucks. */ /* TODO: use a hash or array, this sucks. */
list_for_each(pos, &ctx->active_reqs) { list_for_each(pos, &ctx->active_reqs) {
struct kiocb *kiocb = list_kiocb(pos); struct kiocb *kiocb = list_kiocb(pos);
if (kiocb->ki_user_obj == iocb && kiocb->ki_key == key) if (kiocb->ki_obj.user == iocb && kiocb->ki_key == key)
return kiocb; return kiocb;
} }
return NULL; return NULL;
...@@ -1195,7 +1195,7 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb, ...@@ -1195,7 +1195,7 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
struct io_event tmp; struct io_event tmp;
pr_debug("calling cancel\n"); pr_debug("calling cancel\n");
memset(&tmp, 0, sizeof(tmp)); memset(&tmp, 0, sizeof(tmp));
tmp.obj = (u64)(unsigned long)kiocb->ki_user_obj; tmp.obj = (u64)(unsigned long)kiocb->ki_obj.user;
tmp.data = kiocb->ki_user_data; tmp.data = kiocb->ki_user_data;
ret = cancel(kiocb, &tmp); ret = cancel(kiocb, &tmp);
if (!ret) { if (!ret) {
......
...@@ -218,9 +218,14 @@ static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __u ...@@ -218,9 +218,14 @@ static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __u
{ {
u32 tmp; u32 tmp;
if(get_user(tmp, &up->base)) if (get_user(tmp, &up->base))
return -EFAULT; return -EFAULT;
kp->base = compat_ptr(tmp);
/* This is actually a physical address stored
* as a void pointer.
*/
kp->base = (void *)(unsigned long) tmp;
__get_user(kp->height, &up->height); __get_user(kp->height, &up->height);
__get_user(kp->width, &up->width); __get_user(kp->width, &up->width);
__get_user(kp->depth, &up->depth); __get_user(kp->depth, &up->depth);
...@@ -3107,7 +3112,8 @@ static int do_ncp_getmountuid2(unsigned int fd, unsigned int cmd, unsigned long ...@@ -3107,7 +3112,8 @@ static int do_ncp_getmountuid2(unsigned int fd, unsigned int cmd, unsigned long
set_fs(old_fs); set_fs(old_fs);
if (!err) if (!err)
err = put_user(kuid, (unsigned int *)compat_ptr(arg)); err = put_user(kuid,
(unsigned int __user *) compat_ptr(arg));
return err; return err;
} }
...@@ -3187,7 +3193,8 @@ static int do_ncp_setobjectname(unsigned int fd, unsigned int cmd, unsigned long ...@@ -3187,7 +3193,8 @@ static int do_ncp_setobjectname(unsigned int fd, unsigned int cmd, unsigned long
static int do_ncp_getprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg) static int do_ncp_getprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg)
{ {
struct ncp_privatedata_ioctl_32 n32, __user *p32 = compat_ptr(arg); struct ncp_privatedata_ioctl_32 n32, __user *p32 = compat_ptr(arg);
struct ncp_privatedata_ioctl *p = __user compat_alloc_user_space(sizeof(*p)); struct ncp_privatedata_ioctl __user *p =
compat_alloc_user_space(sizeof(*p));
u32 len; u32 len;
int err; int err;
...@@ -3209,8 +3216,10 @@ static int do_ncp_getprivatedata(unsigned int fd, unsigned int cmd, unsigned lon ...@@ -3209,8 +3216,10 @@ static int do_ncp_getprivatedata(unsigned int fd, unsigned int cmd, unsigned lon
static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg) static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned long arg)
{ {
struct ncp_privatedata_ioctl_32 n32, *p32 = compat_ptr(arg); struct ncp_privatedata_ioctl_32 n32;
struct ncp_privatedata_ioctl *p = compat_alloc_user_space(sizeof(*p)); struct ncp_privatedata_ioctl_32 __user *p32 = compat_ptr(arg);
struct ncp_privatedata_ioctl __user *p =
compat_alloc_user_space(sizeof(*p));
if (copy_from_user(&n32, p32, sizeof(n32)) || if (copy_from_user(&n32, p32, sizeof(n32)) ||
put_user(n32.len, &p->len) || put_user(n32.len, &p->len) ||
......
...@@ -59,7 +59,10 @@ struct kiocb { ...@@ -59,7 +59,10 @@ struct kiocb {
struct list_head ki_list; /* the aio core uses this struct list_head ki_list; /* the aio core uses this
* for cancellation */ * for cancellation */
void __user *ki_user_obj; /* pointer to userland's iocb */ union {
void __user *user;
struct task_struct *tsk;
} ki_obj;
__u64 ki_user_data; /* user's data for completion */ __u64 ki_user_data; /* user's data for completion */
loff_t ki_pos; loff_t ki_pos;
...@@ -76,7 +79,7 @@ struct kiocb { ...@@ -76,7 +79,7 @@ struct kiocb {
(x)->ki_filp = (filp); \ (x)->ki_filp = (filp); \
(x)->ki_ctx = &tsk->active_mm->default_kioctx; \ (x)->ki_ctx = &tsk->active_mm->default_kioctx; \
(x)->ki_cancel = NULL; \ (x)->ki_cancel = NULL; \
(x)->ki_user_obj = tsk; \ (x)->ki_obj.tsk = tsk; \
} while (0) } while (0)
#define AIO_RING_MAGIC 0xa10a10a1 #define AIO_RING_MAGIC 0xa10a10a1
......
...@@ -186,7 +186,7 @@ void __devinit calibrate_delay(void) ...@@ -186,7 +186,7 @@ void __devinit calibrate_delay(void)
loops_per_jiffy = (1<<12); loops_per_jiffy = (1<<12);
printk("Calibrating delay loop... "); printk("Calibrating delay loop... ");
while (loops_per_jiffy <<= 1) { while ((loops_per_jiffy <<= 1) != 0) {
/* wait for "start of" clock tick */ /* wait for "start of" clock tick */
ticks = jiffies; ticks = jiffies;
while (ticks == jiffies) while (ticks == jiffies)
...@@ -632,7 +632,7 @@ static int init(void * unused) ...@@ -632,7 +632,7 @@ static int init(void * unused)
* check if there is an early userspace init. If yes, let it do all * check if there is an early userspace init. If yes, let it do all
* the work * the work
*/ */
if (sys_access("/init", 0) == 0) if (sys_access((const char __user *) "/init", 0) == 0)
execute_command = "/init"; execute_command = "/init";
else else
prepare_namespace(); prepare_namespace();
...@@ -646,7 +646,7 @@ static int init(void * unused) ...@@ -646,7 +646,7 @@ static int init(void * unused)
unlock_kernel(); unlock_kernel();
system_state = SYSTEM_RUNNING; system_state = SYSTEM_RUNNING;
if (sys_open("/dev/console", O_RDWR, 0) < 0) if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
printk("Warning: unable to open an initial console.\n"); printk("Warning: unable to open an initial console.\n");
(void) sys_dup(0); (void) sys_dup(0);
......
...@@ -182,7 +182,7 @@ asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set) ...@@ -182,7 +182,7 @@ asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set)
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_sigpending(&s); ret = sys_sigpending((old_sigset_t __user *) &s);
set_fs(old_fs); set_fs(old_fs);
if (ret == 0) if (ret == 0)
ret = put_user(s, set); ret = put_user(s, set);
...@@ -200,7 +200,9 @@ asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set, ...@@ -200,7 +200,9 @@ asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set,
return -EFAULT; return -EFAULT;
old_fs = get_fs(); old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL); ret = sys_sigprocmask(how,
set ? (old_sigset_t __user *) &s : NULL,
oset ? (old_sigset_t __user *) &s : NULL);
set_fs(old_fs); set_fs(old_fs);
if (ret == 0) if (ret == 0)
if (oset) if (oset)
...@@ -223,7 +225,7 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, int val, ...@@ -223,7 +225,7 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, int val,
timeout = timespec_to_jiffies(&t) + 1; timeout = timespec_to_jiffies(&t) + 1;
} }
if (op >= FUTEX_REQUEUE) if (op >= FUTEX_REQUEUE)
val2 = (int) (long) utime; val2 = (int) (unsigned long) utime;
return do_futex((unsigned long)uaddr, op, val, timeout, return do_futex((unsigned long)uaddr, op, val, timeout,
(unsigned long)uaddr2, val2, val3); (unsigned long)uaddr2, val2, val3);
...@@ -250,7 +252,7 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource, ...@@ -250,7 +252,7 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource,
if (r.rlim_max == COMPAT_RLIM_INFINITY) if (r.rlim_max == COMPAT_RLIM_INFINITY)
r.rlim_max = RLIM_INFINITY; r.rlim_max = RLIM_INFINITY;
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_setrlimit(resource, &r); ret = sys_setrlimit(resource, (struct rlimit __user *) &r);
set_fs(old_fs); set_fs(old_fs);
return ret; return ret;
} }
...@@ -292,7 +294,7 @@ asmlinkage long compat_sys_getrlimit (unsigned int resource, ...@@ -292,7 +294,7 @@ asmlinkage long compat_sys_getrlimit (unsigned int resource,
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_getrlimit(resource, &r); ret = sys_getrlimit(resource, (struct rlimit __user *) &r);
set_fs(old_fs); set_fs(old_fs);
if (!ret) { if (!ret) {
if (r.rlim_cur > COMPAT_RLIM_INFINITY) if (r.rlim_cur > COMPAT_RLIM_INFINITY)
...@@ -340,7 +342,7 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru) ...@@ -340,7 +342,7 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru)
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_getrusage(who, &r); ret = sys_getrusage(who, (struct rusage __user *) &r);
set_fs(old_fs); set_fs(old_fs);
if (ret) if (ret)
...@@ -365,7 +367,10 @@ compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options, ...@@ -365,7 +367,10 @@ compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options,
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
set_fs (KERNEL_DS); set_fs (KERNEL_DS);
ret = sys_wait4(pid, stat_addr ? &status : NULL, options, &r); ret = sys_wait4(pid,
(stat_addr ?
(unsigned int __user *) &status : NULL),
options, (struct rusage __user *) &r);
set_fs (old_fs); set_fs (old_fs);
if (ret > 0) { if (ret > 0) {
...@@ -382,18 +387,18 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, ...@@ -382,18 +387,18 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
unsigned int len, unsigned int len,
compat_ulong_t __user *user_mask_ptr) compat_ulong_t __user *user_mask_ptr)
{ {
unsigned long kernel_mask; unsigned long kern_mask;
mm_segment_t old_fs; mm_segment_t old_fs;
int ret; int ret;
if (get_user(kernel_mask, user_mask_ptr)) if (get_user(kern_mask, user_mask_ptr))
return -EFAULT; return -EFAULT;
old_fs = get_fs(); old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_sched_setaffinity(pid, ret = sys_sched_setaffinity(pid,
sizeof(kernel_mask), sizeof(kern_mask),
&kernel_mask); (unsigned long __user *) &kern_mask);
set_fs(old_fs); set_fs(old_fs);
return ret; return ret;
...@@ -402,20 +407,20 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, ...@@ -402,20 +407,20 @@ asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid,
asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
compat_ulong_t __user *user_mask_ptr) compat_ulong_t __user *user_mask_ptr)
{ {
unsigned long kernel_mask; unsigned long kern_mask;
mm_segment_t old_fs; mm_segment_t old_fs;
int ret; int ret;
old_fs = get_fs(); old_fs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sys_sched_getaffinity(pid, ret = sys_sched_getaffinity(pid,
sizeof(kernel_mask), sizeof(kern_mask),
&kernel_mask); (unsigned long __user *) &kern_mask);
set_fs(old_fs); set_fs(old_fs);
if (ret > 0) { if (ret > 0) {
ret = sizeof(compat_ulong_t); ret = sizeof(compat_ulong_t);
if (put_user(kernel_mask, user_mask_ptr)) if (put_user(kern_mask, user_mask_ptr))
return -EFAULT; return -EFAULT;
} }
...@@ -454,7 +459,9 @@ long compat_timer_settime(timer_t timer_id, int flags, ...@@ -454,7 +459,9 @@ long compat_timer_settime(timer_t timer_id, int flags,
return -EFAULT; return -EFAULT;
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
err = sys_timer_settime(timer_id, flags, &newts, &oldts); err = sys_timer_settime(timer_id, flags,
(struct itimerspec __user *) &newts,
(struct itimerspec __user *) &oldts);
set_fs(oldfs); set_fs(oldfs);
if (!err && old && put_compat_itimerspec(old, &oldts)) if (!err && old && put_compat_itimerspec(old, &oldts))
return -EFAULT; return -EFAULT;
...@@ -467,9 +474,11 @@ long compat_timer_gettime(timer_t timer_id, ...@@ -467,9 +474,11 @@ long compat_timer_gettime(timer_t timer_id,
long err; long err;
mm_segment_t oldfs; mm_segment_t oldfs;
struct itimerspec ts; struct itimerspec ts;
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
err = sys_timer_gettime(timer_id, &ts); err = sys_timer_gettime(timer_id,
(struct itimerspec __user *) &ts);
set_fs(oldfs); set_fs(oldfs);
if (!err && put_compat_itimerspec(setting, &ts)) if (!err && put_compat_itimerspec(setting, &ts))
return -EFAULT; return -EFAULT;
...@@ -482,11 +491,13 @@ long compat_clock_settime(clockid_t which_clock, ...@@ -482,11 +491,13 @@ long compat_clock_settime(clockid_t which_clock,
long err; long err;
mm_segment_t oldfs; mm_segment_t oldfs;
struct timespec ts; struct timespec ts;
if (get_compat_timespec(&ts, tp)) if (get_compat_timespec(&ts, tp))
return -EFAULT; return -EFAULT;
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
err = sys_clock_settime(which_clock, &ts); err = sys_clock_settime(which_clock,
(struct timespec __user *) &ts);
set_fs(oldfs); set_fs(oldfs);
return err; return err;
} }
...@@ -497,9 +508,11 @@ long compat_clock_gettime(clockid_t which_clock, ...@@ -497,9 +508,11 @@ long compat_clock_gettime(clockid_t which_clock,
long err; long err;
mm_segment_t oldfs; mm_segment_t oldfs;
struct timespec ts; struct timespec ts;
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
err = sys_clock_gettime(which_clock, &ts); err = sys_clock_gettime(which_clock,
(struct timespec __user *) &ts);
set_fs(oldfs); set_fs(oldfs);
if (!err && put_compat_timespec(&ts, tp)) if (!err && put_compat_timespec(&ts, tp))
return -EFAULT; return -EFAULT;
...@@ -512,9 +525,11 @@ long compat_clock_getres(clockid_t which_clock, ...@@ -512,9 +525,11 @@ long compat_clock_getres(clockid_t which_clock,
long err; long err;
mm_segment_t oldfs; mm_segment_t oldfs;
struct timespec ts; struct timespec ts;
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
err = sys_clock_getres(which_clock, &ts); err = sys_clock_getres(which_clock,
(struct timespec __user *) &ts);
set_fs(oldfs); set_fs(oldfs);
if (!err && put_compat_timespec(&ts, tp)) if (!err && put_compat_timespec(&ts, tp))
return -EFAULT; return -EFAULT;
...@@ -528,11 +543,15 @@ long compat_clock_nanosleep(clockid_t which_clock, int flags, ...@@ -528,11 +543,15 @@ long compat_clock_nanosleep(clockid_t which_clock, int flags,
long err; long err;
mm_segment_t oldfs; mm_segment_t oldfs;
struct timespec in, out; struct timespec in, out;
if (get_compat_timespec(&in, rqtp)) if (get_compat_timespec(&in, rqtp))
return -EFAULT; return -EFAULT;
oldfs = get_fs(); oldfs = get_fs();
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
err = sys_clock_nanosleep(which_clock, flags, &in, &out); err = sys_clock_nanosleep(which_clock, flags,
(struct timespec __user *) &in,
(struct timespec __user *) &out);
set_fs(oldfs); set_fs(oldfs);
if ((err == -ERESTART_RESTARTBLOCK) && rmtp && if ((err == -ERESTART_RESTARTBLOCK) && rmtp &&
put_compat_timespec(&out, rmtp)) put_compat_timespec(&out, rmtp))
......
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