aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2006-10-29 08:45:58 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-29 15:07:37 -0500
commitd46a3d0d07ba539aea5b0e1ad30e568f0cb03576 (patch)
tree2db10dd06537a27bbdd16080c56db33f884812bb /kernel
parent5211e6e6c671f0d4b1e1a1023384d20227d8ee65 (diff)
[PATCH] taskstats: fix sk_buff leak
'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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/taskstats.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 8adfb8069c6d..f3c3e9d43d2c 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -411,7 +411,7 @@ static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
411 return send_reply(rep_skb, info->snd_pid); 411 return send_reply(rep_skb, info->snd_pid);
412 412
413nla_put_failure: 413nla_put_failure:
414 return genlmsg_cancel(rep_skb, reply); 414 rc = genlmsg_cancel(rep_skb, reply);
415err: 415err:
416 nlmsg_free(rep_skb); 416 nlmsg_free(rep_skb);
417 return rc; 417 return rc;
@@ -507,7 +507,6 @@ send:
507 507
508nla_put_failure: 508nla_put_failure:
509 genlmsg_cancel(rep_skb, reply); 509 genlmsg_cancel(rep_skb, reply);
510 goto ret;
511err_skb: 510err_skb:
512 nlmsg_free(rep_skb); 511 nlmsg_free(rep_skb);
513ret: 512ret: