summaryrefslogtreecommitdiff
path: root/net/devlink
diff options
context:
space:
mode:
authorMoshe Shemesh <moshe@nvidia.com>2023-02-06 18:56:16 +0300
committerJakub Kicinski <kuba@kernel.org>2023-02-08 07:21:33 +0300
commitcb6b2e11a42decea2afc77df73ec7326db1ac25f (patch)
tree1699233ca015a03745147fc6603cf28e61e1e378 /net/devlink
parentf817554786ddc75e0960ea542061fc43a1f2f7e2 (diff)
downloadlinux-cb6b2e11a42decea2afc77df73ec7326db1ac25f.tar.xz
devlink: Fix memleak in health diagnose callback
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> Link: https://lore.kernel.org/r/1675698976-45993-1-git-send-email-moshe@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/devlink')
-rw-r--r--net/devlink/leftover.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/net/devlink/leftover.c b/net/devlink/leftover.c
index 97d30ea98b00..9d6373603340 100644
--- a/net/devlink/leftover.c
+++ b/net/devlink/leftover.c
@@ -6626,18 +6626,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