]> err.no Git - linux-2.6/commitdiff
[PATCH] taskstats: fix sk_buff leak
authorOleg Nesterov <oleg@tv-sign.ru>
Sun, 29 Oct 2006 13:45:58 +0000 (16:45 +0300)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 29 Oct 2006 20:07:37 +0000 (12:07 -0800)
'return genlmsg_cancel()' in taskstats_user_cmd/taskstats_exit_send
potentially leaks a skb.  Unless we pass 'rep_skb' to the netlink layer
we own sk_buff.  This means we should always do kfree_skb() on failure.

[ Thomas acked and pointed out missing return value in original version ]

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Acked-by: Thomas Graf <tgraf@suug.ch>
Cc: Andrew Morton <akpm@osdl.org>
Cc: Shailabh Nagar <nagar@watson.ibm.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Jay Lan <jlan@sgi.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/taskstats.c

index 8adfb8069c6d52be1893b8bd26175d7da9aac838..f3c3e9d43d2cdb41374afb7a2e941ef57a945c84 100644 (file)
@@ -411,7 +411,7 @@ static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
        return send_reply(rep_skb, info->snd_pid);
 
 nla_put_failure:
-       return genlmsg_cancel(rep_skb, reply);
+       rc = genlmsg_cancel(rep_skb, reply);
 err:
        nlmsg_free(rep_skb);
        return rc;
@@ -507,7 +507,6 @@ send:
 
 nla_put_failure:
        genlmsg_cancel(rep_skb, reply);
-       goto ret;
 err_skb:
        nlmsg_free(rep_skb);
 ret: