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 <[EMAIL PROTECTED]>

--- 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);
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to