projects
/
GitHub
/
MotorolaMobilityLLC
/
kernel-slsi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
091f0ea
)
tg3: Fix race condition in tg3_get_stats64()
author
Michael Chan
<mchan@broadcom.com>
Sun, 29 Jul 2012 19:15:44 +0000
(19:15 +0000)
committer
David S. Miller
<davem@davemloft.net>
Mon, 30 Jul 2012 06:18:31 +0000
(23:18 -0700)
Spinlock should be taken before checking for tp->hw_stats.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/tg3.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/net/ethernet/broadcom/tg3.c
b/drivers/net/ethernet/broadcom/tg3.c
index 50045ed1e8c022fc9f1f2faa98fecdc9b00a825e..f03614be9fd529600c5e90a01647f88957492932 100644
(file)
--- a/
drivers/net/ethernet/broadcom/tg3.c
+++ b/
drivers/net/ethernet/broadcom/tg3.c
@@
-12524,10
+12524,12
@@
static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev,
{
struct tg3 *tp = netdev_priv(dev);
- if (!tp->hw_stats)
+ spin_lock_bh(&tp->lock);
+ if (!tp->hw_stats) {
+ spin_unlock_bh(&tp->lock);
return &tp->net_stats_prev;
+ }
- spin_lock_bh(&tp->lock);
tg3_get_nstats(tp, stats);
spin_unlock_bh(&tp->lock);