Skip to content

Commit

Permalink
thermal: core: Adding missing nlmsg_free() in thermal_genl_sampling_t…
Browse files Browse the repository at this point in the history
…emp()

thermal_genl_sampling_temp() misses to call nlmsg_free() in an error path.

Jump to out_free to fix it.

Fixes: 1ce50e7 ("thermal: core: genetlink support for events/cmd/sampling")
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200929082652.59876-1-jingxiangfeng@huawei.com
  • Loading branch information
Jing Xiangfeng authored and Daniel Lezcano committed Oct 12, 2020
1 parent 5093402 commit 48b4585
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/thermal/thermal_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 48b4585

Please sign in to comment.