diff mbox series

[net-next] net/mlx5: HWS, check the correct variable in hws_send_ring_alloc_sq()

Message ID da822315-02b7-4f5b-9c86-0d5176c5069d@stanley.mountain (mailing list archive)
State Accepted
Commit be461814aa4cb32aae061404b9a6a83ef3895018
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net/mlx5: HWS, check the correct variable in hws_send_ring_alloc_sq() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-09-14--15-00 (tests: 764)

Commit Message

Dan Carpenter Sept. 14, 2024, 9:58 a.m. UTC
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>
---
 .../net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_send.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Horman Sept. 14, 2024, 3:39 p.m. UTC | #1
On Sat, Sep 14, 2024 at 12:58:26PM +0300, Dan Carpenter wrote:
> 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>
patchwork-bot+netdevbpf@kernel.org Sept. 15, 2024, 4:01 p.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 14 Sep 2024 12:58:26 +0300 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [net-next] net/mlx5: HWS, check the correct variable in hws_send_ring_alloc_sq()
    https://git.kernel.org/netdev/net-next/c/be461814aa4c

You are awesome, thank you!
diff mbox series

Patch

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 fb97a15c041a..a1adbb48735c 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;
 	}