* [PATCH] net/mlx5: fix memory leak in mlx5_fw_fatal_reporter_dump
@ 2019-09-27 22:37 Navid Emamdoost
2019-09-28 6:07 ` Leon Romanovsky
2019-10-15 20:33 ` Saeed Mahameed
0 siblings, 2 replies; 3+ messages in thread
From: Navid Emamdoost @ 2019-09-27 22:37 UTC (permalink / raw)
Cc: emamd001, kjlu, smccaman, Navid Emamdoost, Saeed Mahameed,
Leon Romanovsky, David S. Miller, netdev, linux-rdma,
linux-kernel
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: 9b1f29823605 ("net/mlx5: Add support for FW fatal reporter dump")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
drivers/net/ethernet/mellanox/mlx5/core/health.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
index d685122d9ff7..c07f3154437c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
@@ -572,7 +572,7 @@ mlx5_fw_fatal_reporter_dump(struct devlink_health_reporter *reporter,
return -ENOMEM;
err = mlx5_crdump_collect(dev, cr_data);
if (err)
- return err;
+ goto free_data;
if (priv_ctx) {
struct mlx5_fw_reporter_ctx *fw_reporter_ctx = priv_ctx;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net/mlx5: fix memory leak in mlx5_fw_fatal_reporter_dump
2019-09-27 22:37 [PATCH] net/mlx5: fix memory leak in mlx5_fw_fatal_reporter_dump Navid Emamdoost
@ 2019-09-28 6:07 ` Leon Romanovsky
2019-10-15 20:33 ` Saeed Mahameed
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2019-09-28 6:07 UTC (permalink / raw)
To: Navid Emamdoost
Cc: emamd001, kjlu, smccaman, Saeed Mahameed, David S. Miller,
netdev, linux-rdma, linux-kernel
On Fri, Sep 27, 2019 at 05:37:28PM -0500, Navid Emamdoost wrote:
> 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: 9b1f29823605 ("net/mlx5: Add support for FW fatal reporter dump")
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/health.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
General note, if you don't write "To:" in your emails, most probably
your emails will be missed by relevant people.
I assume that Saeed will pick this patch and fix extra line between
Fixes and SOB.
Thanks, for fixing it.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/mlx5: fix memory leak in mlx5_fw_fatal_reporter_dump
2019-09-27 22:37 [PATCH] net/mlx5: fix memory leak in mlx5_fw_fatal_reporter_dump Navid Emamdoost
2019-09-28 6:07 ` Leon Romanovsky
@ 2019-10-15 20:33 ` Saeed Mahameed
1 sibling, 0 replies; 3+ messages in thread
From: Saeed Mahameed @ 2019-10-15 20:33 UTC (permalink / raw)
To: navid.emamdoost
Cc: linux-rdma, davem, emamd001, linux-kernel, netdev, smccaman, leon, kjlu
On Fri, 2019-09-27 at 17:37 -0500, Navid Emamdoost wrote:
> 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: 9b1f29823605 ("net/mlx5: Add support for FW fatal reporter
> dump")
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
>
Applied to net-next-mlx5, will be sent to net-next shortly, i will fix
the extra empty line as Leon pointed out.
Thanks,
Saeed.
> ---
> drivers/net/ethernet/mellanox/mlx5/core/health.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c
> b/drivers/net/ethernet/mellanox/mlx5/core/health.c
> index d685122d9ff7..c07f3154437c 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
> @@ -572,7 +572,7 @@ mlx5_fw_fatal_reporter_dump(struct
> devlink_health_reporter *reporter,
> return -ENOMEM;
> err = mlx5_crdump_collect(dev, cr_data);
> if (err)
> - return err;
> + goto free_data;
>
> if (priv_ctx) {
> struct mlx5_fw_reporter_ctx *fw_reporter_ctx =
> priv_ctx;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-15 20:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-27 22:37 [PATCH] net/mlx5: fix memory leak in mlx5_fw_fatal_reporter_dump Navid Emamdoost
2019-09-28 6:07 ` Leon Romanovsky
2019-10-15 20:33 ` Saeed Mahameed
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).