[3/6] net/bnxt: avoid potential out of bounds read
Checks
Commit Message
If hardware returned a bogus number of vnic's from the
query it could cause an out of bounds read into vnic table.
Reported-by: Christopher Ertl <Christopher.Ertl@microsoft.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/bnxt/bnxt_hwrm.c | 6 ++++++
1 file changed, 6 insertions(+)
@@ -4029,6 +4029,12 @@ static int bnxt_hwrm_func_vf_vnic_query(struct bnxt *bp, uint16_t vf,
HWRM_UNLOCK();
+ if (rc > bp->pf.total_vnics) {
+ PMD_DRV_LOG(ERR,
+ "Vnic id %d is out of range\n", rc);
+ return -EINVAL;
+ }
+
return rc;
}