]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net/mlx5: Fix memory leak in cmd_exec()
authorChiara Meiohas <cmeiohas@nvidia.com>
Thu, 17 Jul 2025 12:06:09 +0000 (15:06 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:04:46 +0000 (12:04 +0200)
commit2621d3069925e3c1907dbbd86cea89f5b307ae16
tree5ec3a9f1abdf41240ba39fee5b382126b99d19f5
parenta8d4748b954584ab7bd800f1a4e46d5b0eeb5ce4
net/mlx5: Fix memory leak in cmd_exec()

[ Upstream commit 3afa3ae3db52e3c216d77bd5907a5a86833806cc ]

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: f086470122d5 ("net/mlx5: cmdif, Return value improvements")
Reported-by: Alex Tereshkin <atereshkin@nvidia.com>
Signed-off-by: Chiara Meiohas <cmeiohas@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Vlad Dumitrescu <vdumitrescu@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/1752753970-261832-2-git-send-email-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/cmd.c