]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
taskstats: cgroupstats_user_cmd() may leak on error
authorJesper Juhl <jj@chaosbits.net>
Thu, 13 Sep 2012 01:01:37 +0000 (11:01 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 17 Sep 2012 10:46:24 +0000 (20:46 +1000)
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>
kernel/taskstats.c

index 123793cd06f931477ae61cb7666a466b616bdfb5..ab558cc66c850803ea5edfbe4e960e56cfdbab7d 100644 (file)
@@ -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;
        }