dev: avoid a race that triggers assertion failure
Subsystems (2)
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
David Miller
maintainerFrom: 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, functiondev_close. The function calls functiondev_deactivate, which calls functiondev_watchdog_downthat deletes the watchdog timer. However, after that, a driver can callnetif_carrier_ok, which calls function__netdev_watchdog_upthat can add the watchdog timer again. Functionunregister_netdevicecalls functiondev_shutdownthat traps the bug !timer_pending(&dev->watchdog_timer). Movingdev_deactivateafternetif_running()has been cleared prevents functionnetif_carrier_onfrom calling__netdev_watchdog_upand adding the watchdog timer again.Signed-off-by Matti Linnanvuori <[email protected]>
Patch applied, thanks.