Skip to content

Commit 0b397b1

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Fix uninitialized variable usage in bnxt_rx_pkt().
In bnxt_rx_pkt(), if the driver encounters BD errors, it will recycle the buffers and jump to the end where the uninitailized variable "len" is referenced. Fix it by adding a new jump label that will skip the length update. This is the most correct fix since the length may not be valid when we get this type of error. Fixes: 6a8788f ("bnxt_en: add support for software dynamic interrupt moderation") Reported-by: Nathan Chancellor <[email protected]> Cc: Nathan Chancellor <[email protected]> Signed-off-by: Michael Chan <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3f93cd3 commit 0b397b1

File tree

1 file changed

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

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
16251625
netdev_warn(bp->dev, "RX buffer error %x\n", rx_err);
16261626
bnxt_sched_reset(bp, rxr);
16271627
}
1628-
goto next_rx;
1628+
goto next_rx_no_len;
16291629
}
16301630

16311631
len = le32_to_cpu(rxcmp->rx_cmp_len_flags_type) >> RX_CMP_LEN_SHIFT;
@@ -1706,12 +1706,13 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
17061706
rc = 1;
17071707

17081708
next_rx:
1709-
rxr->rx_prod = NEXT_RX(prod);
1710-
rxr->rx_next_cons = NEXT_RX(cons);
1711-
17121709
cpr->rx_packets += 1;
17131710
cpr->rx_bytes += len;
17141711

1712+
next_rx_no_len:
1713+
rxr->rx_prod = NEXT_RX(prod);
1714+
rxr->rx_next_cons = NEXT_RX(cons);
1715+
17151716
next_rx_no_prod_no_len:
17161717
*raw_cons = tmp_raw_cons;
17171718

0 commit comments

Comments
 (0)