diff options
Diffstat (limited to 'kernel/compat.c')
-rw-r--r-- | kernel/compat.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/kernel/compat.c b/kernel/compat.c index 8c9cd88b6785..b9bdd1271f44 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/syscalls.h> | 21 | #include <linux/syscalls.h> |
22 | #include <linux/unistd.h> | 22 | #include <linux/unistd.h> |
23 | #include <linux/security.h> | 23 | #include <linux/security.h> |
24 | #include <linux/timex.h> | ||
24 | 25 | ||
25 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
26 | 27 | ||
@@ -898,3 +899,61 @@ asmlinkage long compat_sys_rt_sigsuspend(compat_sigset_t __user *unewset, compat | |||
898 | return -ERESTARTNOHAND; | 899 | return -ERESTARTNOHAND; |
899 | } | 900 | } |
900 | #endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */ | 901 | #endif /* __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND */ |
902 | |||
903 | asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp) | ||
904 | { | ||
905 | struct timex txc; | ||
906 | int ret; | ||
907 | |||
908 | memset(&txc, 0, sizeof(struct timex)); | ||
909 | |||
910 | if (!access_ok(VERIFY_READ, utp, sizeof(struct compat_timex)) || | ||
911 | __get_user(txc.modes, &utp->modes) || | ||
912 | __get_user(txc.offset, &utp->offset) || | ||
913 | __get_user(txc.freq, &utp->freq) || | ||
914 | __get_user(txc.maxerror, &utp->maxerror) || | ||
915 | __get_user(txc.esterror, &utp->esterror) || | ||
916 | __get_user(txc.status, &utp->status) || | ||
917 | __get_user(txc.constant, &utp->constant) || | ||
918 | __get_user(txc.precision, &utp->precision) || | ||
919 | __get_user(txc.tolerance, &utp->tolerance) || | ||
920 | __get_user(txc.time.tv_sec, &utp->time.tv_sec) || | ||
921 | __get_user(txc.time.tv_usec, &utp->time.tv_usec) || | ||
922 | __get_user(txc.tick, &utp->tick) || | ||
923 | __get_user(txc.ppsfreq, &utp->ppsfreq) || | ||
924 | __get_user(txc.jitter, &utp->jitter) || | ||
925 | __get_user(txc.shift, &utp->shift) || | ||
926 | __get_user(txc.stabil, &utp->stabil) || | ||
927 | __get_user(txc.jitcnt, &utp->jitcnt) || | ||
928 | __get_user(txc.calcnt, &utp->calcnt) || | ||
929 | __get_user(txc.errcnt, &utp->errcnt) || | ||
930 | __get_user(txc.stbcnt, &utp->stbcnt)) | ||
931 | return -EFAULT; | ||
932 | |||
933 | ret = do_adjtimex(&txc); | ||
934 | |||
935 | if (!access_ok(VERIFY_WRITE, utp, sizeof(struct compat_timex)) || | ||
936 | __put_user(txc.modes, &utp->modes) || | ||
937 | __put_user(txc.offset, &utp->offset) || | ||
938 | __put_user(txc.freq, &utp->freq) || | ||
939 | __put_user(txc.maxerror, &utp->maxerror) || | ||
940 | __put_user(txc.esterror, &utp->esterror) || | ||
941 | __put_user(txc.status, &utp->status) || | ||
942 | __put_user(txc.constant, &utp->constant) || | ||
943 | __put_user(txc.precision, &utp->precision) || | ||
944 | __put_user(txc.tolerance, &utp->tolerance) || | ||
945 | __put_user(txc.time.tv_sec, &utp->time.tv_sec) || | ||
946 | __put_user(txc.time.tv_usec, &utp->time.tv_usec) || | ||
947 | __put_user(txc.tick, &utp->tick) || | ||
948 | __put_user(txc.ppsfreq, &utp->ppsfreq) || | ||
949 | __put_user(txc.jitter, &utp->jitter) || | ||
950 | __put_user(txc.shift, &utp->shift) || | ||
951 | __put_user(txc.stabil, &utp->stabil) || | ||
952 | __put_user(txc.jitcnt, &utp->jitcnt) || | ||
953 | __put_user(txc.calcnt, &utp->calcnt) || | ||
954 | __put_user(txc.errcnt, &utp->errcnt) || | ||
955 | __put_user(txc.stbcnt, &utp->stbcnt)) | ||
956 | ret = -EFAULT; | ||
957 | |||
958 | return ret; | ||
959 | } | ||