Skip to contentSkip to conversation

net_sched: potential jiffy wrap bug in dev_watchdog

PATCH Applied Stephen Hemminger 2 participants 2 messages May 15, 2006 – May 16, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net_sched: potential jiffy wrap bug in dev_watchdog

There is a potential jiffy wraparound bug in the transmit watchdog that is easily avoided by using time_after().

net/sched/sch_generic.c +4 -2
@@ -193,8 +193,10 @@ static void dev_watchdog(unsigned long a
 		    netif_running(dev) &&
 		    netif_carrier_ok(dev)) {
 			if (netif_queue_stopped(dev) &&
-			    (jiffies - dev->trans_start) > dev->watchdog_timeo) {
-				printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n", dev->name);
+			    time_after(jiffies, dev->trans_start + dev->watchdog_timeo)) {
+
+				printk(KERN_INFO "NETDEV WATCHDOG: %s: transmit timed out\n",
+				       dev->name);
 				dev->tx_timeout(dev);
 			}
 			if (!mod_timer(&dev->watchdog_timer, jiffies + dev->watchdog_timeo))