From: Stefan Rompf <stefan@loplof.de>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
Subject: [PATCH] core: linkwatch should use jiffies64
Date: Sun, 7 May 2006 12:13:56 +0200 [thread overview]
Message-ID: <200605071213.56877.stefan@loplof.de> (raw)
Hi,
the linkwatch code can overflow on a jiffies wrap, scheduling
work with a too large delay. If the delay is >0x80000000,
internal_add_timer() seems to overflow too, hiding the bug, so
this isn't triggered too easily.
Best solution is to use jiffies64 for calculation as these
events happen with any possible delay in between.
This should be 2.6.17 stuff.
Signed-off-by: Stefan Rompf <stefan@loplof.de>
--- linux-2.6.17-rc3/net/core/link_watch.c.orig 2006-04-27 20:37:09.000000000 +0200
+++ linux-2.6.17-rc3/net/core/link_watch.c 2006-04-27 21:49:00.000000000 +0200
@@ -32,8 +32,8 @@
LW_SE_USED
};
+static u64 linkwatch_nextevent;
static unsigned long linkwatch_flags;
-static unsigned long linkwatch_nextevent;
static void linkwatch_event(void *dummy);
static DECLARE_WORK(linkwatch_work, linkwatch_event, NULL);
@@ -136,7 +136,7 @@
* cause a storm of messages on the netlink
* socket
*/
- linkwatch_nextevent = jiffies + HZ;
+ linkwatch_nextevent = get_jiffies_64() + HZ;
clear_bit(LW_RUNNING, &linkwatch_flags);
rtnl_lock();
@@ -170,7 +170,7 @@
spin_unlock_irqrestore(&lweventlist_lock, flags);
if (!test_and_set_bit(LW_RUNNING, &linkwatch_flags)) {
- unsigned long thisevent = jiffies;
+ u64 thisevent = get_jiffies_64();
if (thisevent >= linkwatch_nextevent) {
schedule_work(&linkwatch_work);
next reply other threads:[~2006-05-07 10:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-07 10:13 Stefan Rompf [this message]
2006-05-08 6:07 ` [PATCH] core: linkwatch should use jiffies64 David S. Miller
2006-05-08 18:28 ` Stefan Rompf
2006-05-09 11:26 ` [NET] linkwatch: Handle jiffies wrap-around Herbert Xu
2006-05-09 16:51 ` Stefan Rompf
2006-05-09 22:28 ` David S. Miller
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=200605071213.56877.stefan@loplof.de \
--to=stefan@loplof.de \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).