diff options
author | Michael Chan <michael.chan@broadcom.com> | 2016-05-04 20:56:43 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-05-04 21:11:37 (GMT) |
commit | 67a95e2022c7f0405408fb1f910283785ece354a (patch) | |
tree | ba7439fac778de34a693ee7a3b0d446f70c5a8ba /drivers/net | |
parent | 32b583a0cb9b757d68c44f2819fa6ccf95dbb953 (diff) | |
download | linux-67a95e2022c7f0405408fb1f910283785ece354a.tar.xz |
bnxt_en: Need memory barrier when processing the completion ring.
The code determines if the next ring entry is valid before proceeding
further to read the rest of the entry. The CPU can re-order and read
the rest of the entry first, possibly reading a stale entry, if DMA
of a new entry happens right after reading it. This issue can be
readily seen on a ppc64 system, causing it to crash.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 72eb29e..f33ff20 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1388,6 +1388,10 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) if (!TX_CMP_VALID(txcmp, raw_cons)) break; + /* The valid test of the entry must be done first before + * reading any further. + */ + rmb(); if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) { tx_pkts++; /* return full budget so NAPI will complete. */ |