]> git.baikalelectronics.ru Git - kernel.git/commit
tg3: Fix race condition in tg3_get_stats64().
authorMichael Chan <michael.chan@broadcom.com>
Fri, 6 Jan 2017 21:18:53 +0000 (16:18 -0500)
committerDavid S. Miller <davem@davemloft.net>
Sun, 8 Jan 2017 02:35:04 +0000 (21:35 -0500)
commit39b325ba12c530cf0b89de79dafedef8d3f12e99
tree86fb8320ceb68c4dbfb22c5100e5382c6528b89d
parente1c205ec57c4bf8683982c1602781b844afd9eca
tg3: Fix race condition in tg3_get_stats64().

The driver's ndo_get_stats64() method is not always called under RTNL.
So it can race with driver close or ethtool reconfigurations.  Fix the
race condition by taking tp->lock spinlock in tg3_free_consistent()
when freeing the tp->hw_stats memory block.  tg3_get_stats64() is
already taking tp->lock.

Reported-by: Wang Yufen <wangyufen@huawei.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/tg3.c