diff options
author | Deepa Dinamani <deepa.kernel@gmail.com> | 2017-08-03 04:51:10 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-09-04 02:21:23 +0200 |
commit | 3ef56dc2678258b7211b1870d034c1666becb2bd (patch) | |
tree | 0798aa4b92b9c2724dbf8ae3db8b852134a10ade /ipc | |
parent | get rid of SYSVIPC_COMPAT on ia64 (diff) | |
download | linux-3ef56dc2678258b7211b1870d034c1666becb2bd.tar.xz linux-3ef56dc2678258b7211b1870d034c1666becb2bd.zip |
ipc: Make sys_semtimedop() y2038 safe
struct timespec is not y2038 safe on 32 bit machines.
Replace timespec with y2038 safe struct timespec64.
Note that the patch only changes the internals without
modifying the syscall interface. This will be part
of a separate series.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/sem.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ipc/sem.c b/ipc/sem.c index 6b832b7fa9fc..feea26f897e7 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -1856,7 +1856,7 @@ out: } static long do_semtimedop(int semid, struct sembuf __user *tsops, - unsigned nsops, const struct timespec *timeout) + unsigned nsops, const struct timespec64 *timeout) { int error = -EINVAL; struct sem_array *sma; @@ -1892,7 +1892,7 @@ static long do_semtimedop(int semid, struct sembuf __user *tsops, error = -EINVAL; goto out_free; } - jiffies_left = timespec_to_jiffies(timeout); + jiffies_left = timespec64_to_jiffies(timeout); } max = 0; @@ -2111,8 +2111,8 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, unsigned, nsops, const struct timespec __user *, timeout) { if (timeout) { - struct timespec ts; - if (copy_from_user(&ts, timeout, sizeof(*timeout))) + struct timespec64 ts; + if (get_timespec64(&ts, timeout)) return -EFAULT; return do_semtimedop(semid, tsops, nsops, &ts); } @@ -2125,8 +2125,8 @@ COMPAT_SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsems, const struct compat_timespec __user *, timeout) { if (timeout) { - struct timespec ts; - if (compat_get_timespec(&ts, timeout)) + struct timespec64 ts; + if (compat_get_timespec64(&ts, timeout)) return -EFAULT; return do_semtimedop(semid, tsems, nsops, &ts); } |