Commit 0aa76ce3 authored by Huang, Xiong's avatar Huang, Xiong Committed by David S. Miller

atl1c: cancel task when interface closed

common_task might be running while close routine is called,
wait/cancel it.
Signed-off-by: default avatarxiong <xiong@qca.qualcomm.com>
Tested-by: default avatarLiu David <dwliu@qca.qualcomm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f56fa567
...@@ -330,6 +330,9 @@ static void atl1c_common_task(struct work_struct *work) ...@@ -330,6 +330,9 @@ static void atl1c_common_task(struct work_struct *work)
adapter = container_of(work, struct atl1c_adapter, common_task); adapter = container_of(work, struct atl1c_adapter, common_task);
netdev = adapter->netdev; netdev = adapter->netdev;
if (test_bit(__AT_DOWN, &adapter->flags))
return;
if (test_and_clear_bit(ATL1C_WORK_EVENT_RESET, &adapter->work_event)) { if (test_and_clear_bit(ATL1C_WORK_EVENT_RESET, &adapter->work_event)) {
netif_device_detach(netdev); netif_device_detach(netdev);
atl1c_down(adapter); atl1c_down(adapter);
...@@ -2311,6 +2314,8 @@ static int atl1c_close(struct net_device *netdev) ...@@ -2311,6 +2314,8 @@ static int atl1c_close(struct net_device *netdev)
struct atl1c_adapter *adapter = netdev_priv(netdev); struct atl1c_adapter *adapter = netdev_priv(netdev);
WARN_ON(test_bit(__AT_RESETTING, &adapter->flags)); WARN_ON(test_bit(__AT_RESETTING, &adapter->flags));
set_bit(__AT_DOWN, &adapter->flags);
cancel_work_sync(&adapter->common_task);
atl1c_down(adapter); atl1c_down(adapter);
atl1c_free_ring_resources(adapter); atl1c_free_ring_resources(adapter);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment