Skip to content

Commit bdf1b5c

Browse files
JiangJiaskuba-moo
authored andcommitted
sfc: Check null pointer of rx_queue->page_ring
Because of the possible failure of the kcalloc, it should be better to set rx_queue->page_ptr_mask to 0 when it happens in order to maintain the consistency. Fixes: 5a6681e ("sfc: separate out SFC4000 ("Falcon") support into new sfc-falcon driver") Signed-off-by: Jiasheng Jiang <[email protected]> Acked-by: Martin Habets <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 99d7fbb commit bdf1b5c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/ethernet/sfc/rx_common.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ static void efx_init_rx_recycle_ring(struct efx_rx_queue *rx_queue)
150150
efx->rx_bufs_per_page);
151151
rx_queue->page_ring = kcalloc(page_ring_size,
152152
sizeof(*rx_queue->page_ring), GFP_KERNEL);
153-
rx_queue->page_ptr_mask = page_ring_size - 1;
153+
if (!rx_queue->page_ring)
154+
rx_queue->page_ptr_mask = 0;
155+
else
156+
rx_queue->page_ptr_mask = page_ring_size - 1;
154157
}
155158

156159
static void efx_fini_rx_recycle_ring(struct efx_rx_queue *rx_queue)

0 commit comments

Comments
 (0)