bnx2x: Fix the race on bp->stats_pending.
authorVladislav Zolotarov <vladz@broadcom.com>
Sun, 9 Jan 2011 02:20:34 +0000 (02:20 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 9 Jan 2011 23:47:47 +0000 (15:47 -0800)
Fix the race on bp->stats_pending between the timer and a LINK_UP event
handler.

Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bnx2x/bnx2x_stats.c

index 6e4d9b1..bda60d5 100644 (file)
@@ -158,6 +158,11 @@ static void bnx2x_storm_stats_post(struct bnx2x *bp)
 
                spin_lock_bh(&bp->stats_lock);
 
+               if (bp->stats_pending) {
+                       spin_unlock_bh(&bp->stats_lock);
+                       return;
+               }
+
                ramrod_data.drv_counter = bp->stats_counter++;
                ramrod_data.collect_port = bp->port.pmf ? 1 : 0;
                for_each_eth_queue(bp, i)