r8169: fix lockdep warning when removing interface
PATCH v2 1/1 r8169: fix lockdep warning when removing interface
The work queue is initialised in rtl_open (when the interface goes up), but canceled in rtl_remove_one (when the PCI device gets removed). If the network interface is not brought up, then the work queue struct is not initialised. When the device is removed, the attempt to cancel the uninitialised work queue causes a lockdep warning.
This patch fixes the issue by moving cancel_work_sync to rtl_close (to match rtl_open). (Note that rtl_close is also called via unregister_netdev in rtl_remove_one.)
--- drivers/net/ethernet/realtek/r8169.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0
b/drivers/net/ethernet/realtek/r8169.c
index 4106a74..880015c 100644
drivers/net/ethernet/realtek/r8169.c +2 -2
@@ -6468,6 +6468,8 @@ static int rtl8169_close(struct net_device *dev)rtl8169_down (dev);rtl_unlock_work (tp); +cancel_work_sync (&tp->wk.work); +free_irq (pdev->irq, dev); dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
@@ -6793,8 +6795,6 @@ static void rtl_remove_one(struct pci_dev *pdev)rtl8168_driver_stop (tp); } -cancel_work_sync (&tp->wk.work); -netif_napi_del (&tp->napi);unregister_netdev (dev);
Signature · 1 line
1.8.3.2
From: Peter Wu <[email protected]>
Date: Mon, 22 Jul 2013 09:53:30 +0200
Quoted 6 lines
The work queue is initialised in
rtl_open(when the interface goes up), but canceled inrtl_remove_one(when the PCI device gets removed). If the network interface is not brought up, then the work queue struct is not initialised. When the device is removed, the attempt to cancel the uninitialised work queue causes a lockdep warning.
Quoted 6 lines
This patch fixes the issue by moving
cancel_work_synctortl_close(to matchrtl_open). (Note thatrtl_closeis also called viaunregister_netdevinrtl_remove_one.)Signed-off-by Peter Wu <[email protected]>Acked-by Francois Romieu <[email protected]>
Applied, thanks.