All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Thomas Graf <tgraf@suug.ch>
Cc: Andrew Morton <akpm@osdl.org>,
	Shailabh Nagar <nagar@watson.ibm.com>,
	Balbir Singh <balbir@in.ibm.com>, Jay Lan <jlan@sgi.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] taskstats: fix? sk_buff leak
Date: Sun, 29 Oct 2006 16:45:58 +0300	[thread overview]
Message-ID: <20061029134557.GA1500@oleg> (raw)
In-Reply-To: <20061029123352.GC12964@postel.suug.ch>

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:


      reply	other threads:[~2006-10-29 12:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-29 13:24 [PATCH] taskstats: fix? sk_buff leak Oleg Nesterov
2006-10-29 12:33 ` Thomas Graf
2006-10-29 13:45   ` Oleg Nesterov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061029134557.GA1500@oleg \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=balbir@in.ibm.com \
    --cc=jlan@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nagar@watson.ibm.com \
    --cc=tgraf@suug.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.