mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
[PATCH] select: time comparison fixes
I got all of these backwards. We want to return min(input timeout, new timeout) to userspace to prevent increasing the time-remaining value. Thanks to Ernst Herzberg <[email protected]> for reporting and diagnosing. Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
200a4552af
commit
74910e6c7d
2 changed files with 6 additions and 6 deletions
|
|
@ -1757,7 +1757,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
|
|||
goto sticky;
|
||||
rtv.tv_usec = jiffies_to_usecs(do_div((*(u64*)&timeout), HZ));
|
||||
rtv.tv_sec = timeout;
|
||||
if (compat_timeval_compare(&rtv, &tv) < 0)
|
||||
if (compat_timeval_compare(&rtv, &tv) >= 0)
|
||||
rtv = tv;
|
||||
if (copy_to_user(tvp, &rtv, sizeof(rtv))) {
|
||||
sticky:
|
||||
|
|
@ -1834,7 +1834,7 @@ asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp,
|
|||
rts.tv_sec++;
|
||||
rts.tv_nsec -= NSEC_PER_SEC;
|
||||
}
|
||||
if (compat_timespec_compare(&rts, &ts) < 0)
|
||||
if (compat_timespec_compare(&rts, &ts) >= 0)
|
||||
rts = ts;
|
||||
copy_to_user(tsp, &rts, sizeof(rts));
|
||||
}
|
||||
|
|
@ -1934,7 +1934,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
|
|||
rts.tv_nsec = jiffies_to_usecs(do_div((*(u64*)&timeout), HZ)) *
|
||||
1000;
|
||||
rts.tv_sec = timeout;
|
||||
if (compat_timespec_compare(&rts, &ts) < 0)
|
||||
if (compat_timespec_compare(&rts, &ts) >= 0)
|
||||
rts = ts;
|
||||
if (copy_to_user(tsp, &rts, sizeof(rts))) {
|
||||
sticky:
|
||||
|
|
|
|||
Loading…
Reference in a new issue