* [PATCH] thermal: core: add the misse nlmsg_free() for thermal_genl_sampling_temp()
@ 2020-09-29 8:26 Jing Xiangfeng
0 siblings, 0 replies; only message in thread
From: Jing Xiangfeng @ 2020-09-29 8:26 UTC (permalink / raw)
To: rui.zhang, daniel.lezcano, amitk; +Cc: linux-pm, linux-kernel, jingxiangfeng
thermal_genl_sampling_temp() misses to call nlmsg_free() in an error path.
Jump to out_free to fix it.
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
---
drivers/thermal/thermal_netlink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/thermal_netlink.c b/drivers/thermal/thermal_netlink.c
index af7b2383e8f6..019f4812def6 100644
--- a/drivers/thermal/thermal_netlink.c
+++ b/drivers/thermal/thermal_netlink.c
@@ -78,7 +78,7 @@ int thermal_genl_sampling_temp(int id, int temp)
hdr = genlmsg_put(skb, 0, 0, &thermal_gnl_family, 0,
THERMAL_GENL_SAMPLING_TEMP);
if (!hdr)
- return -EMSGSIZE;
+ goto out_free;
if (nla_put_u32(skb, THERMAL_GENL_ATTR_TZ_ID, id))
goto out_cancel;
@@ -93,6 +93,7 @@ int thermal_genl_sampling_temp(int id, int temp)
return 0;
out_cancel:
genlmsg_cancel(skb, hdr);
+out_free:
nlmsg_free(skb);
return -EMSGSIZE;
--
2.26.0.106.g9fadedd
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-29 8:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29 8:26 [PATCH] thermal: core: add the misse nlmsg_free() for thermal_genl_sampling_temp() Jing Xiangfeng
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).