mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
[PATCH] fs: sys_poll with timeout -1 bug fix
If you do a poll() call with timeout -1, the wait will be a big number (depending on HZ) instead of infinite wait, since -1 is passed to the msecs_to_jiffies function. Signed-off-by: Frode Isaksen <[email protected]> Acked-by: Nishanth Aravamudan <[email protected]> Cc: David Woodhouse <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
8bdd1d1250
commit
04a3446c90
1 changed files with 5 additions and 2 deletions
|
|
@ -746,9 +746,9 @@ out_fds:
|
|||
asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
|
||||
long timeout_msecs)
|
||||
{
|
||||
s64 timeout_jiffies = 0;
|
||||
s64 timeout_jiffies;
|
||||
|
||||
if (timeout_msecs) {
|
||||
if (timeout_msecs > 0) {
|
||||
#if HZ > 1000
|
||||
/* We can only overflow if HZ > 1000 */
|
||||
if (timeout_msecs / 1000 > (s64)0x7fffffffffffffffULL / (s64)HZ)
|
||||
|
|
@ -756,6 +756,9 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
|
|||
else
|
||||
#endif
|
||||
timeout_jiffies = msecs_to_jiffies(timeout_msecs);
|
||||
} else {
|
||||
/* Infinite (< 0) or no (0) timeout */
|
||||
timeout_jiffies = timeout_msecs;
|
||||
}
|
||||
|
||||
return do_sys_poll(ufds, nfds, &timeout_jiffies);
|
||||
|
|
|
|||
Loading…
Reference in a new issue