From: Dan Carpenter Date: Sat, 14 Sep 2024 09:58:26 +0000 (+0300) Subject: net/mlx5: HWS, check the correct variable in hws_send_ring_alloc_sq() X-Git-Tag: v6.12-rc1~232^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be461814aa4cb32aae061404b9a6a83ef3895018;p=thirdparty%2Fkernel%2Flinux.git net/mlx5: HWS, check the correct variable in hws_send_ring_alloc_sq() 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 Reviewed-by: Simon Horman Link: https://patch.msgid.link/da822315-02b7-4f5b-9c86-0d5176c5069d@stanley.mountain Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_send.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_send.c index fb97a15c041a1..a1adbb48735c1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_send.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_send.c @@ -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; }