Skip to content

Commit c7ed6d0

Browse files
NavidemSaeed Mahameed
authored and
Saeed Mahameed
committed
net/mlx5: fix memory leak in mlx5_fw_fatal_reporter_dump
In mlx5_fw_fatal_reporter_dump if mlx5_crdump_collect fails the allocated memory for cr_data must be released otherwise there will be memory leak. To fix this, this commit changes the return instruction into goto error handling. Fixes: 9b1f298 ("net/mlx5: Add support for FW fatal reporter dump") Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
1 parent c8c2a05 commit c7ed6d0

File tree

1 file changed

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

1 file changed

+1
-1
lines changed

Diff for: drivers/net/ethernet/mellanox/mlx5/core/health.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ mlx5_fw_fatal_reporter_dump(struct devlink_health_reporter *reporter,
572572
return -ENOMEM;
573573
err = mlx5_crdump_collect(dev, cr_data);
574574
if (err)
575-
return err;
575+
goto free_data;
576576

577577
if (priv_ctx) {
578578
struct mlx5_fw_reporter_ctx *fw_reporter_ctx = priv_ctx;

0 commit comments

Comments
 (0)