netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Patrick McHardy <kaber@trash.net>
Cc: "Denis V. Lunev" <dlunev@gmail.com>,
	"Denis V. Lunev" <den@openvz.org>,
	davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] memory leak in netlink user->kernel processing
Date: Mon, 01 Oct 2007 10:42:45 -0600	[thread overview]
Message-ID: <m13awuyeey.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <47010C3B.7040902@trash.net> (Patrick McHardy's message of "Mon, 01 Oct 2007 17:03:23 +0200")

Patrick McHardy <kaber@trash.net> writes:

> Denis V. Lunev wrote:
>> By the way, Patrick, this looks like nlk->pid == 0 if and only if this
>> is a kernel socket. Right?
>>
>
> Thats correct.
>
>> I have told with Alexey Kuznetsov and we have discrovered a way to get
>> rid of
>>         skb_queue_tail(&sk->sk_receive_queue, skb);
>>         sk->sk_data_ready(sk, len);
>> in netlink_sendskb/etc for kernel sockets and make user->kernel packets
>> processing truly synchronous.
>>
>> The idea is simple, we should queue/wakeup in kernel->user direction and
>> simply call nlk->data_ready for user->kernel direction. This will remove
>> all the crap we have now. But we need a mark to determine the direction.
>> Which one will be better? (nlk->data_ready) or (nlk->pid == 0)
>
>
> Both would work fine, but I think nlk->pid is better since its
> actually the "address".

Maybe.  nlk->pid is also 0, before the socket is bound so it does
not serve as a reliable indicator that you have a kernel socket.

My gut feel says the best test is:
(nlk->flags & NETLINK_KERNEL_SOCKET)

There is no confusion in that and it is dead obvious what we
are testing for.  Although we do still need to properly handle
the case when netlink_kernel_create is called with a NULL
input method.  As long as get the proper -ECONNREFUSED the
code path doesn't look like it matters.

Eric


      reply	other threads:[~2007-10-01 16:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-01 14:29 [PATCH] memory leak in netlink user->kernel processing Denis V. Lunev
2007-10-01 14:36 ` Patrick McHardy
2007-10-01 14:58   ` Denis V. Lunev
2007-10-01 15:03     ` Patrick McHardy
2007-10-01 16:42       ` Eric W. Biederman [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=m13awuyeey.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=davem@davemloft.net \
    --cc=den@openvz.org \
    --cc=dlunev@gmail.com \
    --cc=kaber@trash.net \
    --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;
as well as URLs for NNTP newsgroup(s).