mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
[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>
This commit is contained in:
parent
d425b274ba
commit
9741ef964d
2 changed files with 6 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -129,9 +129,11 @@ asmlinkage long compat_sys_futex(u32 __user *uaddr, int op, u32 val,
|
|||
unsigned long timeout = MAX_SCHEDULE_TIMEOUT;
|
||||
int val2 = 0;
|
||||
|
||||
if ((op == FUTEX_WAIT) && utime) {
|
||||
if (utime && (op == FUTEX_WAIT)) {
|
||||
if (get_compat_timespec(&t, utime))
|
||||
return -EFAULT;
|
||||
if (!timespec_valid(&t))
|
||||
return -EINVAL;
|
||||
timeout = timespec_to_jiffies(&t) + 1;
|
||||
}
|
||||
if (op >= FUTEX_REQUEUE)
|
||||
|
|
Loading…
Reference in a new issue