From 893c784eef7036066057d3886c53ef66279a1c4c Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Tue, 4 Jan 2022 14:08:15 +0530 Subject: [PATCH] net/bnxt: add null check for mark table [ upstream commit 8a553bdf261f4e05a774d243bf0278ac1baf55c8 ] 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") Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt_rxr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c index 43cb8057da..f923b35ce2 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -760,6 +760,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;