aboutsummaryrefslogtreecommitdiffstats
path: root/fs/eventpoll.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/eventpoll.c')
-rw-r--r--fs/eventpoll.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 403b90a1213d..4284cd31eba6 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -101,6 +101,10 @@
101/* Maximum number of poll wake up nests we are allowing */ 101/* Maximum number of poll wake up nests we are allowing */
102#define EP_MAX_POLLWAKE_NESTS 4 102#define EP_MAX_POLLWAKE_NESTS 4
103 103
104/* Maximum msec timeout value storeable in a long int */
105#define EP_MAX_MSTIMEO min(1000ULL * MAX_SCHEDULE_TIMEOUT / HZ, (LONG_MAX - 999ULL) / HZ)
106
107
104struct epoll_filefd { 108struct epoll_filefd {
105 struct file *file; 109 struct file *file;
106 int fd; 110 int fd;
@@ -1506,8 +1510,8 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
1506 * and the overflow condition. The passed timeout is in milliseconds, 1510 * and the overflow condition. The passed timeout is in milliseconds,
1507 * that why (t * HZ) / 1000. 1511 * that why (t * HZ) / 1000.
1508 */ 1512 */
1509 jtimeout = timeout == -1 || timeout > (MAX_SCHEDULE_TIMEOUT - 1000) / HZ ? 1513 jtimeout = (timeout < 0 || timeout >= EP_MAX_MSTIMEO) ?
1510 MAX_SCHEDULE_TIMEOUT: (timeout * HZ + 999) / 1000; 1514 MAX_SCHEDULE_TIMEOUT : (timeout * HZ + 999) / 1000;
1511 1515
1512retry: 1516retry:
1513 write_lock_irqsave(&ep->lock, flags); 1517 write_lock_irqsave(&ep->lock, flags);