net/bnxt: add null check for mark table

During the port start, driver ignores mark table allocation failure.
This could cause a segfault due to NULL pointer dereference in
bnxt_set_mark_in_mbuf(). Fix this by checking the pointer validity
before accessing it.

Fixes: b87abb2e55cb ("net/bnxt: support marking packet")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
This commit is contained in:
Kalesh AP 2022-01-04 14:08:15 +05:30 committed by Ajit Khaparde
parent caf6c007da
commit 8a553bdf26

View File

@ -824,6 +824,9 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp,
{
uint32_t cfa_code = 0;
if (unlikely(bp->mark_table == NULL))
return;
cfa_code = rte_le_to_cpu_16(rxcmp1->cfa_code);
if (!cfa_code)
return;