diff options
-rw-r--r-- | fs/compat.c | 23 | ||||
-rw-r--r-- | include/linux/compat.h | 5 | ||||
-rw-r--r-- | kernel/compat.c | 8 |
3 files changed, 32 insertions, 4 deletions
diff --git a/fs/compat.c b/fs/compat.c index 2487b83b18df..7b21b0a82596 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -2225,3 +2225,26 @@ asmlinkage long compat_sys_signalfd(int ufd, | |||
2225 | 2225 | ||
2226 | #endif /* CONFIG_SIGNALFD */ | 2226 | #endif /* CONFIG_SIGNALFD */ |
2227 | 2227 | ||
2228 | #ifdef CONFIG_TIMERFD | ||
2229 | |||
2230 | asmlinkage long compat_sys_timerfd(int ufd, int clockid, int flags, | ||
2231 | const struct compat_itimerspec __user *utmr) | ||
2232 | { | ||
2233 | long res; | ||
2234 | struct itimerspec t; | ||
2235 | struct itimerspec __user *ut; | ||
2236 | |||
2237 | res = -EFAULT; | ||
2238 | if (get_compat_itimerspec(&t, utmr)) | ||
2239 | goto err_exit; | ||
2240 | ut = compat_alloc_user_space(sizeof(*ut)); | ||
2241 | if (copy_to_user(ut, &t, sizeof(t)) ) | ||
2242 | goto err_exit; | ||
2243 | |||
2244 | res = sys_timerfd(ufd, clockid, flags, ut); | ||
2245 | err_exit: | ||
2246 | return res; | ||
2247 | } | ||
2248 | |||
2249 | #endif /* CONFIG_TIMERFD */ | ||
2250 | |||
diff --git a/include/linux/compat.h b/include/linux/compat.h index 70a157a130bb..636502c02734 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -225,6 +225,11 @@ static inline int compat_timespec_compare(struct compat_timespec *lhs, | |||
225 | return lhs->tv_nsec - rhs->tv_nsec; | 225 | return lhs->tv_nsec - rhs->tv_nsec; |
226 | } | 226 | } |
227 | 227 | ||
228 | extern int get_compat_itimerspec(struct itimerspec *dst, | ||
229 | const struct compat_itimerspec __user *src); | ||
230 | extern int put_compat_itimerspec(struct compat_itimerspec __user *dst, | ||
231 | const struct itimerspec *src); | ||
232 | |||
228 | asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); | 233 | asmlinkage long compat_sys_adjtimex(struct compat_timex __user *utp); |
229 | 234 | ||
230 | extern int compat_printk(const char *fmt, ...); | 235 | extern int compat_printk(const char *fmt, ...); |
diff --git a/kernel/compat.c b/kernel/compat.c index cebb4c28c039..3bae3742c2aa 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -475,8 +475,8 @@ asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, | |||
475 | return min_length; | 475 | return min_length; |
476 | } | 476 | } |
477 | 477 | ||
478 | static int get_compat_itimerspec(struct itimerspec *dst, | 478 | int get_compat_itimerspec(struct itimerspec *dst, |
479 | struct compat_itimerspec __user *src) | 479 | const struct compat_itimerspec __user *src) |
480 | { | 480 | { |
481 | if (get_compat_timespec(&dst->it_interval, &src->it_interval) || | 481 | if (get_compat_timespec(&dst->it_interval, &src->it_interval) || |
482 | get_compat_timespec(&dst->it_value, &src->it_value)) | 482 | get_compat_timespec(&dst->it_value, &src->it_value)) |
@@ -484,8 +484,8 @@ static int get_compat_itimerspec(struct itimerspec *dst, | |||
484 | return 0; | 484 | return 0; |
485 | } | 485 | } |
486 | 486 | ||
487 | static int put_compat_itimerspec(struct compat_itimerspec __user *dst, | 487 | int put_compat_itimerspec(struct compat_itimerspec __user *dst, |
488 | struct itimerspec *src) | 488 | const struct itimerspec *src) |
489 | { | 489 | { |
490 | if (put_compat_timespec(&src->it_interval, &dst->it_interval) || | 490 | if (put_compat_timespec(&src->it_interval, &dst->it_interval) || |
491 | put_compat_timespec(&src->it_value, &dst->it_value)) | 491 | put_compat_timespec(&src->it_value, &dst->it_value)) |