From: Peter Spreadborough <[email protected]>

A backing store table allocation failed due to lack of memory and
resulted in a crash because the result of the allocation was not
checked for validity.

Signed-off-by: Peter Spreadborough <[email protected]>
Reviewed-by: Manish Kurup <[email protected]>
---
 drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c 
b/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c
index b229f07596..878f62c115 100644
--- a/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c
+++ b/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c
@@ -505,6 +505,8 @@ static int alloc_link_pbl(struct tfc_ts_mem_cfg *mem_cfg, 
uint32_t page_size,
                                                                
RTE_MEMZONE_SIZE_HINT_ONLY |
                                                                
RTE_MEMZONE_IOVA_CONTIG,
                                                                page_size);
+               if (!mem_cfg->ts_mz.mz)
+                       return -ENOMEM;
        }
        memset(mem_cfg->ts_mz.mz->addr, 0, mem_cfg->ts_mz.mz->len);
        mem_cfg->ts_mz.page_count = total_pages;
-- 
2.39.5 (Apple Git-154)

Reply via email to