taskstats: fix? sk_buff leak
PATCH 1/1 taskstats: fix? sk_buff leak
Compile tested only, and I know nothing about net/. Needs an ack from maintainer.
'return genlmsg_cancel()' in taskstats_user_cmd/taskstats_exit_send looks wrong to me. Unless we pass 'rep_skb' to the netlink layer we own sk_buff, yes? This means we should always do kfree_skb() on failure.
kernel/taskstats.c renamed from kernel/taskstats.c~1_skb +1 -2
@@ -411,7 +411,7 @@ static int taskstats_user_cmd(struct sk_return send_reply (rep_skb, info->snd_pid); nla_put_failure: -return genlmsg_cancel (rep_skb, reply); +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:
* Oleg Nesterov <[email protected]> 2006-10-29 16:24
Quoted 6 lines
Compile tested only, and I know nothing about
net/. Needs an ack from maintainer.'return
genlmsg_cancel()' in taskstats_user_cmd/taskstats_exit_send looks wrong to me. Unless we pass 'rep_skb' to the netlink layer we ownsk_buff, yes? This means we should always dokfree_skb()on failure.
That's right.
kernel/taskstats.c static int taskstats_user_cmd(struct sk_ · line 414
Quoted 10 lines
Signed-off-by Oleg Nesterov <[email protected]>kernel/taskstats.c renamed from kernel/taskstats.c~1_skb +1
-1@@ -411,7 +411,7 @@ static int taskstats_user_cmd(struct sk_return send_reply (rep_skb, info->snd_pid); nla_put_failure: -return genlmsg_cancel (rep_skb, reply); +genlmsg_cancel (rep_skb, reply);
rc = genlmsg_cancel(...) or return value is undefined.
Quoted 12 lines
kernel/taskstats.c renamed from kernel/taskstats.c~1_skb +0
-1err: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:
Quoted 7 lines · Thomas Graf
* Oleg Nesterov <[email protected]> 2006-10-29 16:24
Review
Quoted 3 lines
nla_put_failure:(quoted diff) +1
-1- return genlmsg_cancel(rep_skb, reply); + genlmsg_cancel(rep_skb, reply);rc =
genlmsg_cancel(...)or return value is undefined.
Thanks!
[PATCH] taskstats: fix sk_buff leak
Compile tested.
'return genlmsg_cancel()' in taskstats_user_cmd/taskstats_exit_send looks wrong to me. Unless we pass 'rep_skb' to the netlink layer we own sk_buff. This means we should always do kfree_skb() on failure.
kernel/taskstats.c renamed from kernel/taskstats.c~1_skb +1 -2
@@ -411,7 +411,7 @@ static int taskstats_user_cmd(struct sk_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: