From: Jesper Juhl Date: Fri, 7 Sep 2012 00:25:14 +0000 (+1000) Subject: taskstats: cgroupstats_user_cmd() may leak on error X-Git-Tag: next-20120907~1^2~1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=631d62303803b7655c53fa32e9e8328ee6f2a8a0;p=karo-tx-linux.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 --- diff --git a/kernel/taskstats.c b/kernel/taskstats.c index d0a32796550f..37708eb5a7a4 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -437,6 +437,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; }