Skip to contentSkip to conversation

dev: avoid a race that triggers assertion failure

PATCH In review Matti Linnanvuori 2 participants 2 messages Feb 13, 2008

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

PATCH v2 1/1 dev: avoid a race that triggers assertion failure

From: Matti Linnanvuori <[email protected]>

There is a race in Linux kernel file net/core/dev.c, function dev_close. The function calls function dev_deactivate, which calls function dev_watchdog_down that deletes the watchdog timer. However, after that, a driver can call netif_carrier_ok, which calls function __netdev_watchdog_up that can add the watchdog timer again. Function unregister_netdevice calls function dev_shutdown that traps the bug !timer_pending(&dev->watchdog_timer). Moving dev_deactivate after netif_running() has been cleared prevents function netif_carrier_on from calling __netdev_watchdog_up and adding the watchdog timer again.

---

      ____________________________________________________________________________________

Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

maintainer
#1 lore raw

From: Matti Linnanvuori <[email protected]>
Date: Tue, 12 Feb 2008 23:06:41 -0800 (PST)

Quoted 11 lines

There is a race in Linux kernel file net/core/dev.c, function dev_close. The function calls function dev_deactivate, which calls function dev_watchdog_down that deletes the watchdog timer. However, after that, a driver can call netif_carrier_ok, which calls function __netdev_watchdog_up that can add the watchdog timer again. Function unregister_netdevice calls function dev_shutdown that traps the bug !timer_pending(&dev->watchdog_timer). Moving dev_deactivate after netif_running() has been cleared prevents function netif_carrier_on from calling __netdev_watchdog_up and adding the watchdog timer again.

Patch applied, thanks.