Message ID | 1619215999-8880-1-git-send-email-michael.chan@broadcom.com |
---|---|
State | New |
Headers | show |
Series | [net] bnxt_en: Fix RX consumer index logic in the error path. | expand |
Hello: This patch was applied to netdev/net.git (refs/heads/master): On Fri, 23 Apr 2021 18:13:19 -0400 you wrote: > In bnxt_rx_pkt(), the RX buffers are expected to complete in order. > If the RX consumer index indicates an out of order buffer completion, > it means we are hitting a hardware bug and the driver will abort all > remaining RX packets and reset the RX ring. The RX consumer index > that we pass to bnxt_discard_rx() is not correct. We should be > passing the current index (tmp_raw_cons) instead of the old index > (raw_cons). This bug can cause us to be at the wrong index when > trying to abort the next RX packet. It can crash like this: > > [...] Here is the summary with links: - [net] bnxt_en: Fix RX consumer index logic in the error path. https://git.kernel.org/netdev/net/c/bbd6f0a94813 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index aeb8c61c0f87..73239d3eaca1 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1732,14 +1732,16 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, cons = rxcmp->rx_cmp_opaque; if (unlikely(cons != rxr->rx_next_cons)) { - int rc1 = bnxt_discard_rx(bp, cpr, raw_cons, rxcmp); + int rc1 = bnxt_discard_rx(bp, cpr, &tmp_raw_cons, rxcmp); /* 0xffff is forced error, don't print it */ if (rxr->rx_next_cons != 0xffff) netdev_warn(bp->dev, "RX cons %x != expected cons %x\n", cons, rxr->rx_next_cons); bnxt_sched_reset(bp, rxr); - return rc1; + if (rc1) + return rc1; + goto next_rx_no_prod_no_len; } rx_buf = &rxr->rx_buf_ring[cons]; data = rx_buf->data;