mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-04 10:12:16 +09:00
tg3: Fix race condition in tg3_get_stats64()
commit 0f566b208b upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
27b8d8aa03
commit
787852ce0c
@@ -12282,10 +12282,12 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev,
|
||||
{
|
||||
struct tg3 *tp = netdev_priv(dev);
|
||||
|
||||
if (!tp->hw_stats)
|
||||
return &tp->net_stats_prev;
|
||||
|
||||
spin_lock_bh(&tp->lock);
|
||||
if (!tp->hw_stats) {
|
||||
spin_unlock_bh(&tp->lock);
|
||||
return &tp->net_stats_prev;
|
||||
}
|
||||
|
||||
tg3_get_nstats(tp, stats);
|
||||
spin_unlock_bh(&tp->lock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user