Commit 7f1ff1b3 authored by Chenyuan Yang's avatar Chenyuan Yang Committed by Jakub Kicinski
Browse files

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 001ba090
("net: fec: handle page_pool_dev_alloc_pages error").

This is found by our static analysis tool KNighter.

Signed-off-by: default avatarChenyuan Yang <chenyuan0y@gmail.com>
Fixes: 3c47e8ae ("net: libwx: Support to receive packets in NAPI")
Reviewed-by: default avatarJoe Damato <jdamato@fastly.com>
Link: https://patch.msgid.link/20250407184952.2111299-1-chenyuan0y@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent dd17a7f1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -310,7 +310,8 @@ static bool wx_alloc_mapped_page(struct wx_ring *rx_ring,
		return true;

	page = page_pool_dev_alloc_pages(rx_ring->page_pool);
	WARN_ON(!page);
	if (unlikely(!page))
		return false;
	dma = page_pool_get_dma_addr(page);

	bi->page_dma = dma;