lkml.org 
[lkml]   [2006]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] taskstats: fix? sk_buff leak
On 10/29, Thomas Graf wrote:
>
> * Oleg Nesterov <oleg@tv-sign.ru> 2006-10-29 16:24
> > nla_put_failure:
> > - 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.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- STATS/kernel/taskstats.c~1_skb 2006-10-29 15:12:51.000000000 +0300
+++ STATS/kernel/taskstats.c 2006-10-29 16:39:10.000000000 +0300
@@ -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:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-10-29 13:49    [W:0.049 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site