Skip to content

Commit 67a95e2

Browse files
Michael Chandavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 32b583a commit 67a95e2

File tree

1 file changed

+4
-0
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+4
-0
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,10 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
13881388
if (!TX_CMP_VALID(txcmp, raw_cons))
13891389
break;
13901390

1391+
/* The valid test of the entry must be done first before
1392+
* reading any further.
1393+
*/
1394+
rmb();
13911395
if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) {
13921396
tx_pkts++;
13931397
/* return full budget so NAPI will complete. */

0 commit comments

Comments
 (0)