From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Nathan Chancellor <natechancellor@gmail.com>
Subject: [PATCH net 6/6] bnxt_en: Fix uninitialized variable usage in bnxt_rx_pkt().
Date: Thu, 25 Apr 2019 22:31:55 -0400 [thread overview]
Message-ID: <1556245915-5430-7-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1556245915-5430-1-git-send-email-michael.chan@broadcom.com>
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: 6a8788f25625 ("bnxt_en: add support for software dynamic interrupt moderation")
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Cc: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index b6cb7b8..52ade13 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -1625,7 +1625,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
netdev_warn(bp->dev, "RX buffer error %x\n", rx_err);
bnxt_sched_reset(bp, rxr);
}
- goto next_rx;
+ goto next_rx_no_len;
}
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,
rc = 1;
next_rx:
- rxr->rx_prod = NEXT_RX(prod);
- rxr->rx_next_cons = NEXT_RX(cons);
-
cpr->rx_packets += 1;
cpr->rx_bytes += len;
+next_rx_no_len:
+ rxr->rx_prod = NEXT_RX(prod);
+ rxr->rx_next_cons = NEXT_RX(cons);
+
next_rx_no_prod_no_len:
*raw_cons = tmp_raw_cons;
--
2.5.1
next prev parent reply other threads:[~2019-04-26 2:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-26 2:31 [PATCH net 0/6] bnxt_en: Misc. bug fixes Michael Chan
2019-04-26 2:31 ` [PATCH net 1/6] bnxt_en: Improve multicast address setup logic Michael Chan
2019-04-26 2:31 ` [PATCH net 2/6] bnxt_en: Free short FW command HWRM memory in error path in bnxt_init_one() Michael Chan
2019-04-26 2:31 ` [PATCH net 3/6] bnxt_en: Fix possible crash in bnxt_hwrm_ring_free() under error conditions Michael Chan
2019-04-26 2:31 ` [PATCH net 4/6] bnxt_en: Pass correct extended TX port statistics size to firmware Michael Chan
2019-04-26 2:31 ` [PATCH net 5/6] bnxt_en: Fix statistics context reservation logic Michael Chan
2019-04-26 2:31 ` Michael Chan [this message]
2019-04-26 13:06 ` [PATCH net 6/6] bnxt_en: Fix uninitialized variable usage in bnxt_rx_pkt() Nathan Chancellor
2019-04-27 21:01 ` [PATCH net 0/6] bnxt_en: Misc. bug fixes David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1556245915-5430-7-git-send-email-michael.chan@broadcom.com \
--to=michael.chan@broadcom.com \
--cc=davem@davemloft.net \
--cc=natechancellor@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).