Skip to content

Commit 7b77d88

Browse files
Yuuoniygregkh
authored andcommitted
eth: mlx4: Fix IS_ERR() vs NULL check bug in mlx4_en_create_rx_ring
[ Upstream commit e580bea ] Replace NULL check with IS_ERR() check after calling page_pool_create() since this function returns error pointers (ERR_PTR). Using NULL check could lead to invalid pointer dereference. Fixes: 8533b14 ("eth: mlx4: create a page pool for Rx") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Link: https://patch.msgid.link/20250828121858.67639-1-linmq006@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c3e20ab commit 7b77d88

File tree

1 file changed

+3
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx4

1 file changed

+3
-1
lines changed

drivers/net/ethernet/mellanox/mlx4/en_rx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv,
267267
pp.dma_dir = priv->dma_dir;
268268

269269
ring->pp = page_pool_create(&pp);
270-
if (!ring->pp)
270+
if (IS_ERR(ring->pp)) {
271+
err = PTR_ERR(ring->pp);
271272
goto err_ring;
273+
}
272274

273275
if (xdp_rxq_info_reg(&ring->xdp_rxq, priv->dev, queue_index, 0) < 0)
274276
goto err_pp;

0 commit comments

Comments
 (0)