]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
bnxt_en: Improve RX consumer index validity check.
authorMichael Chan <michael.chan@broadcom.com>
Mon, 8 Apr 2019 21:39:54 +0000 (17:39 -0400)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit239b46623d19802e0ff600bf9f0e185fed86ce88
treee2d84d9451241b8c8df4aa6745a7249c4815d825
parent7ae96281ca17c77f092134a46bd3ea263a3a2601
bnxt_en: Improve RX consumer index validity check.

BugLink: https://bugs.launchpad.net/bugs/1838116
[ Upstream commit a1b0e4e684e9c300b9e759b46cb7a0147e61ddff ]

There is logic to check that the RX/TPA consumer index is the expected
index to work around a hardware problem.  However, the potentially bad
consumer index is first used to index into an array to reference an entry.
This can potentially crash if the bad consumer index is beyond legal
range.  Improve the logic to use the consumer index for dereferencing
after the validity check and log an error message.

Fixes: fa7e28127a5a ("bnxt_en: Add workaround to detect bad opaque in rx completion (part 2)")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c