Skip to content

Commit 3fd0da4

Browse files
devnexenPaolo Abeni
authored andcommitted
net: lan966x: fix page_pool error handling in lan966x_fdma_rx_alloc_page_pool()
page_pool_create() can return an ERR_PTR on failure. The return value is used unconditionally in the loop that follows, passing the error pointer through xdp_rxq_info_reg_mem_model() into page_pool_use_xdp_mem(), which dereferences it, causing a kernel oops. Add an IS_ERR check after page_pool_create() to return early on failure. Fixes: 11871ab ("net: lan96x: Use page_pool API") Cc: stable@vger.kernel.org Signed-off-by: David Carlier <devnexen@gmail.com> Link: https://patch.msgid.link/20260405055241.35767-2-devnexen@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent c71ba66 commit 3fd0da4

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ static int lan966x_fdma_rx_alloc_page_pool(struct lan966x_rx *rx)
9191
pp_params.dma_dir = DMA_BIDIRECTIONAL;
9292

9393
rx->page_pool = page_pool_create(&pp_params);
94+
if (unlikely(IS_ERR(rx->page_pool)))
95+
return PTR_ERR(rx->page_pool);
9496

9597
for (int i = 0; i < lan966x->num_phys_ports; ++i) {
9698
struct lan966x_port *port;

0 commit comments

Comments
 (0)