Skip to content

Commit 3afa3ae

Browse files
chiarameiohaskuba-moo
authored andcommitted
net/mlx5: Fix memory leak in cmd_exec()
If cmd_exec() is called with callback and mlx5_cmd_invoke() returns an error, resources allocated in cmd_exec() will not be freed. Fix the code to release the resources if mlx5_cmd_invoke() returns an error. Fixes: f086470 ("net/mlx5: cmdif, Return value improvements") Reported-by: Alex Tereshkin <[email protected]> Signed-off-by: Chiara Meiohas <[email protected]> Reviewed-by: Moshe Shemesh <[email protected]> Signed-off-by: Vlad Dumitrescu <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 6e86fb7 commit 3afa3ae

File tree

1 file changed

+2
-2
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+2
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/cmd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1947,8 +1947,8 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
19471947

19481948
err = mlx5_cmd_invoke(dev, inb, outb, out, out_size, callback, context,
19491949
pages_queue, token, force_polling);
1950-
if (callback)
1951-
return err;
1950+
if (callback && !err)
1951+
return 0;
19521952

19531953
if (err > 0) /* Failed in FW, command didn't execute */
19541954
err = deliv_status_to_err(err);

0 commit comments

Comments
 (0)