提交 0f566b20 编写于 作者: M Michael Chan 提交者: David S. Miller

tg3: Fix race condition in tg3_get_stats64()

Spinlock should be taken before checking for tp->hw_stats.
Signed-off-by: NMichael Chan <mchan@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 091f0ea3
...@@ -12524,10 +12524,12 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev, ...@@ -12524,10 +12524,12 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev,
{ {
struct tg3 *tp = netdev_priv(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; return &tp->net_stats_prev;
}
spin_lock_bh(&tp->lock);
tg3_get_nstats(tp, stats); tg3_get_nstats(tp, stats);
spin_unlock_bh(&tp->lock); spin_unlock_bh(&tp->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册