summaryrefslogtreecommitdiffstats
path: root/kernel/time/time.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-06-07 09:42:34 +0100
committerThomas Gleixner <tglx@linutronix.de>2017-06-14 00:00:43 +0200
commit3a4d44b6162555070194e486ff6b3799a8d323a2 (patch)
tree095069878df5402d3616164b523fe7e65e894f6f /kernel/time/time.c
parentfb923c4a3c2ee735755d4a93522150fc35d0ecbd (diff)
downloadblackbird-obmc-linux-3a4d44b6162555070194e486ff6b3799a8d323a2.tar.gz
blackbird-obmc-linux-3a4d44b6162555070194e486ff6b3799a8d323a2.zip
ntp: Move adjtimex related compat syscalls to native counterparts
Get rid of set_fs() mess and sanitize compat_{get,put}_timex(), while we are at it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: John Stultz <john.stultz@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20170607084241.28657-9-viro@ZenIV.linux.org.uk
Diffstat (limited to 'kernel/time/time.c')
-rw-r--r--kernel/time/time.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/kernel/time/time.c b/kernel/time/time.c
index 49c73c6ed648..400662f16c5a 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -39,6 +39,7 @@
#include <linux/ptrace.h>
#include <linux/uaccess.h>
+#include <linux/compat.h>
#include <asm/unistd.h>
#include <generated/timeconst.h>
@@ -224,12 +225,33 @@ SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p)
* structure. But bear in mind that the structures
* may change
*/
- if(copy_from_user(&txc, txc_p, sizeof(struct timex)))
+ if (copy_from_user(&txc, txc_p, sizeof(struct timex)))
return -EFAULT;
ret = do_adjtimex(&txc);
return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : ret;
}
+#ifdef CONFIG_COMPAT
+
+COMPAT_SYSCALL_DEFINE1(adjtimex, struct compat_timex __user *, utp)
+{
+ struct timex txc;
+ int err, ret;
+
+ err = compat_get_timex(&txc, utp);
+ if (err)
+ return err;
+
+ ret = do_adjtimex(&txc);
+
+ err = compat_put_timex(utp, &txc);
+ if (err)
+ return err;
+
+ return ret;
+}
+#endif
+
/*
* Convert jiffies to milliseconds and back.
*
OpenPOWER on IntegriCloud