]> www.infradead.org Git - users/jedix/linux-maple.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)
committerBrian Maly <brian.maly@oracle.com>
Tue, 19 Mar 2019 16:48:46 +0000 (12:48 -0400)
commit16b201b3a4b2368fe87d22bf5b00bcf20b3ae387
tree6cad6ae350e8baa0f1bf658170445a098a76fbb9
parent9c0e4d398e7180269e3b166eb0de13d4f2965df2
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: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f9b76ebd49f97458857568918c305a17fa7c6567)
Signed-off-by: aru kolappan <aru.kolappan@oracle.com>
Orabug: 29129625

Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
Signed-off-by: aru kolappan <aru.kolappan@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h