]> git.baikalelectronics.ru Git - kernel.git/commit
bnxt_en: Fix race conditions in .ndo_get_stats64().
authorMichael Chan <michael.chan@broadcom.com>
Tue, 11 Jul 2017 17:05:34 +0000 (13:05 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Jul 2017 17:32:11 +0000 (10:32 -0700)
commitfef4cd0612e68279c84df8866bda80fd6a4d6103
tree993131304daeabca1f46a01b902ab4224280ac35
parent0dd90aaba0cb9082d9da0165d53fb1c62105a314
bnxt_en: Fix race conditions in .ndo_get_stats64().

.ndo_get_stats64() may not be protected by RTNL and can race with
.ndo_stop() or other ethtool operations that can free the statistics
memory.  Fix it by setting a new flag BNXT_STATE_READ_STATS and then
proceeding to read statistics memory only if the state is OPEN.  The
close path that frees the memory clears the OPEN state and then waits
for the BNXT_STATE_READ_STATS to clear before proceeding to free the
statistics memory.

Fixes: 93658deae41f ("bnxt_en: New Broadcom ethernet driver.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h