Skip to content

Commit

Permalink
net/bnxt: add null check for mark table
Browse files Browse the repository at this point in the history
[ upstream commit 8a553bd ]

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: b87abb2 ("net/bnxt: support marking packet")

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>
  • Loading branch information
Kalesh AP authored and kevintraynor committed Feb 21, 2022
1 parent a31a8b6 commit 6b722d7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/bnxt/bnxt_rxr.c
Expand Up @@ -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;
Expand Down

0 comments on commit 6b722d7

Please sign in to comment.