From: Jesper Juhl Date: Fri, 5 Oct 2012 00:16:52 +0000 (-0700) Subject: taskstats: cgroupstats_user_cmd() may leak on error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0324b5a450f8a58304e93c5d886add24ca3527bc;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git taskstats: cgroupstats_user_cmd() may leak on error If prepare_reply() succeeds we have allocated memory for 'rep_skb'. If nla_reserve() then subsequently fails and returns NULL we fail to release the memory we allocated, thus causing a leak. Signed-off-by: Jesper Juhl Cc: Balbir Singh Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 610f0838d555..145bb4d3bd4d 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -445,6 +445,7 @@ static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info) na = nla_reserve(rep_skb, CGROUPSTATS_TYPE_CGROUP_STATS, sizeof(struct cgroupstats)); if (na == NULL) { + nlmsg_free(rep_skb); rc = -EMSGSIZE; goto err; }