Skip to content

Commit

Permalink
Merge pull request #8 from jfornal/jfornal_igb_avb
Browse files Browse the repository at this point in the history
Fixing potential race condition: igb_down vs igb_watchdog_task
  • Loading branch information
andrew-elder authored Oct 22, 2018
2 parents 45e5262 + f47c181 commit e0e6ffc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions kmod/igb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1878,6 +1878,15 @@ void igb_down(struct igb_adapter *adapter)
struct e1000_hw *hw = &adapter->hw;
u32 tctl, rctl;
int i;

/* deleting timer and work queue sync
of igb_watchdog task at the begining
to avoid race condition between igb_down
and watchdog - performing required actions
before altering the adapter state and registers
*/
del_timer_sync(&adapter->watchdog_timer);
cancel_work_sync(&adapter->watchdog_task);

/* signal that we're down so the interrupt handler does not
* reschedule our watchdog timer
Expand Down Expand Up @@ -1906,8 +1915,7 @@ void igb_down(struct igb_adapter *adapter)
igb_irq_disable(adapter);

adapter->flags &= ~IGB_FLAG_NEED_LINK_UPDATE;

del_timer_sync(&adapter->watchdog_timer);

if (adapter->flags & IGB_FLAG_DETECT_BAD_DMA)
del_timer_sync(&adapter->dma_err_timer);
del_timer_sync(&adapter->phy_info_timer);
Expand Down

0 comments on commit e0e6ffc

Please sign in to comment.