summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_misc.c
diff options
context:
space:
mode:
authordchagin <dchagin@FreeBSD.org>2016-01-09 17:11:25 +0000
committerdchagin <dchagin@FreeBSD.org>2016-01-09 17:11:25 +0000
commit0e75fd64e782579dbb101bf9698adbedec1c2806 (patch)
tree490eeaf3e559443b63b2f3930818e57fdfd2a2ae /sys/compat/linux/linux_misc.c
parentf9c41e34075d6689e15e9bfd4ff205f852c56d8a (diff)
downloadFreeBSD-src-0e75fd64e782579dbb101bf9698adbedec1c2806.zip
FreeBSD-src-0e75fd64e782579dbb101bf9698adbedec1c2806.tar.gz
MFC r283463:
Do not use struct l_timespec without conversion. While here move args->timeout handling before acquiring the futex key at FUTEX_WAIT path.
Diffstat (limited to 'sys/compat/linux/linux_misc.c')
-rw-r--r--sys/compat/linux/linux_misc.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 45d6bb2..9806e03 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -89,6 +89,7 @@ __FBSDID("$FreeBSD$");
#include <compat/linux/linux_file.h>
#include <compat/linux/linux_mib.h>
#include <compat/linux/linux_signal.h>
+#include <compat/linux/linux_timer.h>
#include <compat/linux/linux_util.h>
#include <compat/linux/linux_sysproto.h>
#include <compat/linux/linux_emul.h>
@@ -2166,8 +2167,9 @@ linux_pselect6(struct thread *td, struct linux_pselect6_args *args)
error = copyin(args->tsp, &lts, sizeof(lts));
if (error != 0)
return (error);
- uts.tv_sec = lts.tv_sec;
- uts.tv_nsec = lts.tv_nsec;
+ error = linux_to_native_timespec(&uts, &lts);
+ if (error != 0)
+ return (error);
TIMESPEC_TO_TIMEVAL(&utv, &uts);
if (itimerfix(&utv))
@@ -2199,8 +2201,8 @@ linux_pselect6(struct thread *td, struct linux_pselect6_args *args)
timevalclear(&utv);
TIMEVAL_TO_TIMESPEC(&utv, &uts);
- lts.tv_sec = uts.tv_sec;
- lts.tv_nsec = uts.tv_nsec;
+
+ native_to_linux_timespec(&lts, &uts);
error = copyout(&lts, args->tsp, sizeof(lts));
}
@@ -2232,8 +2234,9 @@ linux_ppoll(struct thread *td, struct linux_ppoll_args *args)
error = copyin(args->tsp, &lts, sizeof(lts));
if (error)
return (error);
- uts.tv_sec = lts.tv_sec;
- uts.tv_nsec = lts.tv_nsec;
+ error = linux_to_native_timespec(&uts, &lts);
+ if (error != 0)
+ return (error);
nanotime(&ts0);
tsp = &uts;
@@ -2252,8 +2255,7 @@ linux_ppoll(struct thread *td, struct linux_ppoll_args *args)
} else
timespecclear(&uts);
- lts.tv_sec = uts.tv_sec;
- lts.tv_nsec = uts.tv_nsec;
+ native_to_linux_timespec(&lts, &uts);
error = copyout(&lts, args->tsp, sizeof(lts));
}
@@ -2341,8 +2343,7 @@ linux_sched_rr_get_interval(struct thread *td,
PROC_UNLOCK(tdt->td_proc);
if (error != 0)
return (error);
- lts.tv_sec = ts.tv_sec;
- lts.tv_nsec = ts.tv_nsec;
+ native_to_linux_timespec(&lts, &ts);
return (copyout(&lts, uap->interval, sizeof(lts)));
}
OpenPOWER on IntegriCloud