From: Miaoqian Lin Date: Thu, 28 Aug 2025 12:18:58 +0000 (+0800) Subject: eth: mlx4: Fix IS_ERR() vs NULL check bug in mlx4_en_create_rx_ring X-Git-Tag: v6.16.6~126 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7b77d8841a98a9f45c8a615222c698df8dec581c;p=thirdparty%2Fkernel%2Fstable.git eth: mlx4: Fix IS_ERR() vs NULL check bug in mlx4_en_create_rx_ring [ Upstream commit e580beaf43d563aaf457f1c7f934002355ebfe7b ] 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: 8533b14b3d65 ("eth: mlx4: create a page pool for Rx") Signed-off-by: Miaoqian Lin Reviewed-by: Vadim Fedorenko Link: https://patch.msgid.link/20250828121858.67639-1-linmq006@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c index b33285d755b90..a626fd0d20735 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c @@ -267,8 +267,10 @@ int mlx4_en_create_rx_ring(struct mlx4_en_priv *priv, pp.dma_dir = priv->dma_dir; ring->pp = page_pool_create(&pp); - if (!ring->pp) + if (IS_ERR(ring->pp)) { + err = PTR_ERR(ring->pp); goto err_ring; + } if (xdp_rxq_info_reg(&ring->xdp_rxq, priv->dev, queue_index, 0) < 0) goto err_pp;