This is a note to let you know that I've just added the patch titled bnxt_en: Fix counter overflow logic. to the 5.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: bnxt_en-fix-counter-overflow-logic.patch and it can be found in the queue-5.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Sun Nov 22 10:24:40 AM CET 2020 From: Michael Chan <michael.chan@xxxxxxxxxxxx> Date: Sun, 15 Nov 2020 19:27:51 -0500 Subject: bnxt_en: Fix counter overflow logic. From: Michael Chan <michael.chan@xxxxxxxxxxxx> [ Upstream commit fa97f303fa4cf8469fd3d1ef29da69c0a3f6ddc8 ] bnxt_add_one_ctr() adds a hardware counter to a software counter and adjusts for the hardware counter wraparound against the mask. The logic assumes that the hardware counter is always smaller than or equal to the mask. This assumption is mostly correct. But in some cases if the firmware is older and does not provide the accurate mask, the driver can use a mask that is smaller than the actual hardware mask. This can cause some extra carry bits to be added to the software counter, resulting in counters that far exceed the actual value. Fix it by masking the hardware counter with the mask passed into bnxt_add_one_ctr(). Fixes: fea6b3335527 ("bnxt_en: Accumulate all counters.") Reviewed-by: Vasundhara Volam <vasundhara-v.volam@xxxxxxxxxxxx> Reviewed-by: Pavan Chebbi <pavan.chebbi@xxxxxxxxxxxx> Reviewed-by: Edwin Peer <edwin.peer@xxxxxxxxxxxx> Signed-off-by: Michael Chan <michael.chan@xxxxxxxxxxxx> Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7617,6 +7617,7 @@ static void bnxt_add_one_ctr(u64 hw, u64 { u64 sw_tmp; + hw &= mask; sw_tmp = (*sw & ~mask) | hw; if (hw < (*sw & mask)) sw_tmp += mask + 1; Patches currently in stable-queue which might be from michael.chan@xxxxxxxxxxxx are queue-5.9/bnxt_en-free-port-stats-during-firmware-reset.patch queue-5.9/bnxt_en-read-eeprom-a2h-address-using-page-0.patch queue-5.9/bnxt_en-fix-counter-overflow-logic.patch queue-5.9/net-b44-fix-error-return-code-in-b44_init_one.patch