All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] devlink: Fix memleak in health diagnose callback
@ 2023-02-06 15:56 Moshe Shemesh
  2023-02-07  6:42 ` Simon Horman
  2023-02-08  4:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Moshe Shemesh @ 2023-02-06 15:56 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, netdev
  Cc: Jiri Pirko, linux-kernel, Moshe Shemesh

The callback devlink_nl_cmd_health_reporter_diagnose_doit() miss
devlink_fmsg_free(), which leads to memory leak.

Fix it by adding devlink_fmsg_free().

Fixes: e994a75fb7f9 ("devlink: remove reporter reference counting")
Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
---
 net/devlink/leftover.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
index 056d9ca14a3d..79bb8320fc3a 100644
--- a/net/devlink/leftover.c
+++ b/net/devlink/leftover.c
@@ -7866,18 +7866,22 @@ static int devlink_nl_cmd_health_reporter_diagnose_doit(struct sk_buff *skb,
 
 	err = devlink_fmsg_obj_nest_start(fmsg);
 	if (err)
-		return err;
+		goto out;
 
 	err = reporter->ops->diagnose(reporter, fmsg, info->extack);
 	if (err)
-		return err;
+		goto out;
 
 	err = devlink_fmsg_obj_nest_end(fmsg);
 	if (err)
-		return err;
+		goto out;
+
+	err = devlink_fmsg_snd(fmsg, info,
+			       DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE, 0);
 
-	return devlink_fmsg_snd(fmsg, info,
-				DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE, 0);
+out:
+	devlink_fmsg_free(fmsg);
+	return err;
 }
 
 static int
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] devlink: Fix memleak in health diagnose callback
  2023-02-06 15:56 [PATCH net-next] devlink: Fix memleak in health diagnose callback Moshe Shemesh
@ 2023-02-07  6:42 ` Simon Horman
  2023-02-08  4:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-02-07  6:42 UTC (permalink / raw)
  To: Moshe Shemesh
  Cc: David S. Miller, Jakub Kicinski, netdev, Jiri Pirko, linux-kernel

On Mon, Feb 06, 2023 at 05:56:16PM +0200, Moshe Shemesh wrote:
> The callback devlink_nl_cmd_health_reporter_diagnose_doit() miss
> devlink_fmsg_free(), which leads to memory leak.
> 
> Fix it by adding devlink_fmsg_free().
> 
> Fixes: e994a75fb7f9 ("devlink: remove reporter reference counting")
> Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] devlink: Fix memleak in health diagnose callback
  2023-02-06 15:56 [PATCH net-next] devlink: Fix memleak in health diagnose callback Moshe Shemesh
  2023-02-07  6:42 ` Simon Horman
@ 2023-02-08  4:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-02-08  4:30 UTC (permalink / raw)
  To: Moshe Shemesh; +Cc: davem, kuba, netdev, jiri, linux-kernel

Hello:

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

On Mon, 6 Feb 2023 17:56:16 +0200 you wrote:
> The callback devlink_nl_cmd_health_reporter_diagnose_doit() miss
> devlink_fmsg_free(), which leads to memory leak.
> 
> Fix it by adding devlink_fmsg_free().
> 
> Fixes: e994a75fb7f9 ("devlink: remove reporter reference counting")
> Signed-off-by: Moshe Shemesh <moshe@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> 
> [...]

Here is the summary with links:
  - [net-next] devlink: Fix memleak in health diagnose callback
    https://git.kernel.org/netdev/net-next/c/cb6b2e11a42d

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-08  4:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06 15:56 [PATCH net-next] devlink: Fix memleak in health diagnose callback Moshe Shemesh
2023-02-07  6:42 ` Simon Horman
2023-02-08  4:30 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.