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 <j...@chaosbits.net>
---
 kernel/taskstats.c | 1 +
 1 file changed, 1 insertion(+)

 Compile tested only.

diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index d0a3279..37708eb 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;
        }
-- 
1.7.11.4


-- 
Jesper Juhl <j...@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to