]> git.dujemihanovic.xyz Git - linux.git/commitdiff
net/mlx5: HWS, check the correct variable in hws_send_ring_alloc_sq()
authorDan Carpenter <dan.carpenter@linaro.org>
Sat, 14 Sep 2024 09:58:26 +0000 (12:58 +0300)
committerJakub Kicinski <kuba@kernel.org>
Sun, 15 Sep 2024 15:38:56 +0000 (08:38 -0700)
There is a copy and paste bug so this code checks "sq->dep_wqe" where
"sq->wr_priv" was intended.  It could result in a NULL pointer
dereference.

Fixes: 2ca62599aa0b ("net/mlx5: HWS, added send engine and context handling")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/da822315-02b7-4f5b-9c86-0d5176c5069d@stanley.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_send.c

index fb97a15c041a150e1c469a2a6c9f883b2842d87b..a1adbb48735c10a2a9cf35a893068a348a632bee 100644 (file)
@@ -584,7 +584,7 @@ static int hws_send_ring_alloc_sq(struct mlx5_core_dev *mdev,
        }
 
        sq->wr_priv = kzalloc(sizeof(*sq->wr_priv) * buf_sz, GFP_KERNEL);
-       if (!sq->dep_wqe) {
+       if (!sq->wr_priv) {
                err = -ENOMEM;
                goto free_dep_wqe;
        }