Skip to content

Commit 39c4dd4

Browse files
Peter Spreadboroughajitkhaparde
authored andcommitted
net/bnxt/tf_core: check backing store allocation
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]> Acked-by: Ajit Khaparde <[email protected]>
1 parent 7e71853 commit 39c4dd4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,8 @@ static int alloc_link_pbl(struct tfc_ts_mem_cfg *mem_cfg, uint32_t page_size,
505505
RTE_MEMZONE_SIZE_HINT_ONLY |
506506
RTE_MEMZONE_IOVA_CONTIG,
507507
page_size);
508+
if (!mem_cfg->ts_mz.mz)
509+
return -ENOMEM;
508510
}
509511
memset(mem_cfg->ts_mz.mz->addr, 0, mem_cfg->ts_mz.mz->len);
510512
mem_cfg->ts_mz.page_count = total_pages;

0 commit comments

Comments
 (0)