Netdev List
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Jesper Juhl <jesper.juhl@gmail.com>
Cc: netdev@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Alan Cox <alan@redhat.com>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	David Miller <davem@davemloft.net>
Subject: Re: Don't leak 'listeners' in netlink_kernel_create()
Date: Sun, 14 Oct 2007 16:30:06 -0600	[thread overview]
Message-ID: <m1hckt5nyp.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <200710142337.01059.jesper.juhl@gmail.com> (Jesper Juhl's message of "Sun, 14 Oct 2007 23:37:00 +0200")

Jesper Juhl <jesper.juhl@gmail.com> writes:

> From: Jesper Juhl <jesper.juhl@gmail.com>
> Subject: Don't leak 'listeners' in netlink_kernel_create()
>
> The Coverity checker spotted that we'll leak the storage allocated 
> to 'listeners' in netlink_kernel_create() when the
>   if (!nl_table[unit].registered)
> check is false.
>
> This patch avoids the leak.
>
>
> Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>

This patch appears trivially correct to me.
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>

> ---
>
>  af_netlink.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> --- linux-2.6/net/netlink/af_netlink.c~	2007-10-14 23:29:50.000000000 +0200
> +++ linux-2.6/net/netlink/af_netlink.c	2007-10-14 23:29:50.000000000 +0200
> @@ -1378,6 +1378,8 @@ netlink_kernel_create(struct net *net, i
>  		nl_table[unit].cb_mutex = cb_mutex;
>  		nl_table[unit].module = module;
>  		nl_table[unit].registered = 1;
> +	} else {
> +		kfree(listeners);
>  	}
>  	netlink_table_ungrab();
>  

       reply	other threads:[~2007-10-14 22:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200710142337.01059.jesper.juhl@gmail.com>
2007-10-14 22:30 ` Eric W. Biederman [this message]
2007-10-15  8:39   ` Don't leak 'listeners' in netlink_kernel_create() David Miller

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=m1hckt5nyp.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=alan@redhat.com \
    --cc=davem@davemloft.net \
    --cc=jesper.juhl@gmail.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox