Skip to content

Commit 7f1ff1b

Browse files
WhiteFox-Projectkuba-moo
authored andcommitted
net: libwx: handle page_pool_dev_alloc_pages error
page_pool_dev_alloc_pages could return NULL. There was a WARN_ON(!page) but it would still proceed to use the NULL pointer and then crash. This is similar to commit 001ba09 ("net: fec: handle page_pool_dev_alloc_pages error"). This is found by our static analysis tool KNighter. Signed-off-by: Chenyuan Yang <[email protected]> Fixes: 3c47e8a ("net: libwx: Support to receive packets in NAPI") Reviewed-by: Joe Damato <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent dd17a7f commit 7f1ff1b

File tree

1 file changed

+2
-1
lines changed
  • drivers/net/ethernet/wangxun/libwx

1 file changed

+2
-1
lines changed

drivers/net/ethernet/wangxun/libwx/wx_lib.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ static bool wx_alloc_mapped_page(struct wx_ring *rx_ring,
310310
return true;
311311

312312
page = page_pool_dev_alloc_pages(rx_ring->page_pool);
313-
WARN_ON(!page);
313+
if (unlikely(!page))
314+
return false;
314315
dma = page_pool_get_dma_addr(page);
315316

316317
bi->page_dma = dma;

0 commit comments

Comments
 (0)