summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiaoqian Lin <linmq006@gmail.com>2025-08-28 20:18:58 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-09-09 19:02:22 +0200
commit7b77d8841a98a9f45c8a615222c698df8dec581c (patch)
treeb4075e0ff0971015c026fe8329b710f9b458c8d2
parentc3e20abfd33d8bed59acdd105024b2d90e1df5d9 (diff)
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 <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>
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index b33285d755b9..a626fd0d2073 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;