Skip to content

Commit

Permalink
tg3: tg3_timer() should grab tp->lock before checking for tp->irq_sync
Browse files Browse the repository at this point in the history
This is to avoid the race between tg3_timer() and the execution paths
which does not invoke tg3_timer_stop() and releases tp->lock before
calling synchronize_irq()

Reported-by: Peter Hurley <peter@hurleysoftware.com>
Tested-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Prashant Sreedharan <prashant@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Prashant Sreedharan authored and davem330 committed Jan 14, 2015
1 parent b0d11b4 commit 4fd190a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -10903,11 +10903,13 @@ static void tg3_timer(unsigned long __opaque)
{
struct tg3 *tp = (struct tg3 *) __opaque;

if (tp->irq_sync || tg3_flag(tp, RESET_TASK_PENDING))
goto restart_timer;

spin_lock(&tp->lock);

if (tp->irq_sync || tg3_flag(tp, RESET_TASK_PENDING)) {
spin_unlock(&tp->lock);
goto restart_timer;
}

if (tg3_asic_rev(tp) == ASIC_REV_5717 ||
tg3_flag(tp, 57765_CLASS))
tg3_chk_missed_msi(tp);
Expand Down

0 comments on commit 4fd190a

Please sign in to comment.