summaryrefslogtreecommitdiffstats
path: root/kernel/futex.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2006-03-31 02:31:32 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-31 12:18:59 -0800
commit9741ef964dc8bfeb6520825df9fed8f538c3336e (patch)
tree6cc09d6b10a9ea9119a3a73e226300d747008bfe /kernel/futex.c
parentd425b274ba83ba4e7746a40446ec0ba3267de51f (diff)
downloadop-kernel-dev-9741ef964dc8bfeb6520825df9fed8f538c3336e.zip
op-kernel-dev-9741ef964dc8bfeb6520825df9fed8f538c3336e.tar.gz
[PATCH] futex: check and validate timevals
The futex timeval is not checked for correctness. The change does not break existing applications as the timeval is supplied by glibc (and glibc always passes a correct value), but the glibc-internal tests for this functionality fail. Signed-off-by: Thomas Gleixner <tglx@tglx.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r--kernel/futex.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 9c9b2b6..5699c51 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1039,9 +1039,11 @@ asmlinkage long sys_futex(u32 __user *uaddr, int op, int val,
unsigned long timeout = MAX_SCHEDULE_TIMEOUT;
int val2 = 0;
- if ((op == FUTEX_WAIT) && utime) {
+ if (utime && (op == FUTEX_WAIT)) {
if (copy_from_user(&t, utime, sizeof(t)) != 0)
return -EFAULT;
+ if (!timespec_valid(&t))
+ return -EINVAL;
timeout = timespec_to_jiffies(&t) + 1;
}
/*
OpenPOWER on IntegriCloud