Skip to content

Commit d5d6169

Browse files
YuuoniyNipaLocal
authored andcommitted
eth: mlx4: Fix IS_ERR() vs NULL check bug in mlx4_en_create_rx_ring
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 <[email protected]> ---- Changes in v3: - fix IS_ERR Changes in v2: - use err = PTR_ERR(ring->pp); v1 link: https://lore.kernel.org/all/[email protected] v2 link: https://lore.kernel.org/all/[email protected] Reviewed-by: Vadim Fedorenko <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent b16ce46 commit d5d6169

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)