OSDN Git Service

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)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Apr 2019 23:39:41 +0000 (16:39 -0700)
commita1b0e4e684e9c300b9e759b46cb7a0147e61ddff
treede1a1c7a7bc61d5c8da7436fe956f10f485ad78f
parenta62520473f15750cd1432d36b377a06cd7cff8d2
bnxt_en: Improve RX consumer index validity check.

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>
drivers/net/ethernet/broadcom/bnxt/bnxt.c