summaryrefslogtreecommitdiffstats
path: root/kernel/taskstats.c
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2012-10-04 17:16:52 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-06 03:05:31 +0900
commit0324b5a450f8a58304e93c5d886add24ca3527bc (patch)
treef3e77339d9964f550485e9d9b40897ba1b95b33f /kernel/taskstats.c
parent322c9ec009fdc2bc9ccb8f55afab3f7ab8ac71ab (diff)
downloadlinux-stable-0324b5a450f8a58304e93c5d886add24ca3527bc.tar.gz
linux-stable-0324b5a450f8a58304e93c5d886add24ca3527bc.tar.bz2
linux-stable-0324b5a450f8a58304e93c5d886add24ca3527bc.zip
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 <jj@chaosbits.net> Cc: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/taskstats.c')
-rw-r--r--kernel/taskstats.c1
1 files changed, 1 insertions, 0 deletions
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;
}