From 631d62303803b7655c53fa32e9e8328ee6f2a8a0 Mon Sep 17 00:00:00 2001 From: Jesper Juhl Date: Fri, 7 Sep 2012 10:25:14 +1000 Subject: [PATCH] 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 --- kernel/taskstats.c | 1 + 1 file changed, 1 insertion(+) 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; } -- 2.39.5