RDMA/bnxt_re: Fix out of bound check
authorKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Tue, 8 Oct 2024 07:41:34 +0000 (00:41 -0700)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 11 Oct 2024 23:49:01 +0000 (20:49 -0300)
commita9e6e7443922ac0a48243c35d03834c96926bff1
tree6ed2313c6b8ed1b07696e34ad287ebe2d7dcf489
parentac6df53738b465053d38d491fff87bd7d37fdc07
RDMA/bnxt_re: Fix out of bound check

Driver exports pacing stats only on GenP5 and P7 adapters. But while
parsing the pacing stats, driver has a check for "rdev->dbr_pacing".  This
caused a trace when KASAN is enabled.

BUG: KASAN: slab-out-of-bounds in bnxt_re_get_hw_stats+0x2b6a/0x2e00 [bnxt_re]
Write of size 8 at addr ffff8885942a6340 by task modprobe/4809

Fixes: 8b6573ff3420 ("bnxt_re: Update the debug counters for doorbell pacing")
Link: https://patch.msgid.link/r/1728373302-19530-3-git-send-email-selvin.xavier@broadcom.com
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/bnxt_re/hw_counters.c