From: frode isaksen <frode.isaksen@gmail.com>
To: akpm@osdl.org, Nishanth Aravamudan <nacc@us.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: sys_poll with timeout -1 bug fix
Date: Thu, 15 Jun 2006 15:05:00 +0200 [thread overview]
Message-ID: <542727CE-8E10-44EB-98E7-15481DE45259@gmail.com> (raw)
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.
Tested on i386 and MIPS with latest (2.6.16) kernel.
Frode
--- linux-2.6.16.20/fs/select.c.orig.c 2006-06-05 19:18:23.000000000
+0200
+++ linux-2.6.16.20/fs/select.c 2006-06-15 14:20:47.000000000 +0200
@@ -699,9 +699,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)
@@ -709,6 +709,9 @@ asmlinkage long sys_poll(struct pollfd _
else
#endif
timeout_jiffies = msecs_to_jiffies(timeout_msecs);
+ } else {
+ /* Infinite (-1) or no (0) timeout */
+ timeout_jiffies = timeout_msecs;
}
return do_sys_poll(ufds, nfds, &timeout_jiffies);
next reply other threads:[~2006-06-15 13:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-15 13:05 frode isaksen [this message]
2006-06-15 15:05 ` Nishanth Aravamudan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=542727CE-8E10-44EB-98E7-15481DE45259@gmail.com \
--to=frode.isaksen@gmail.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nacc@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®