netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	netfilter-devel@vger.kernel.org,
	Stephen Hemminger <shemminger@vyatta.com>
Subject: Re: [PATCH] netfilter: ctnetlink: fix (really) race condition between dump_table and destroy
Date: Mon, 24 Jan 2011 14:37:35 +0100	[thread overview]
Message-ID: <4D3D809F.30808@trash.net> (raw)
In-Reply-To: <4D3D7DD5.9020902@netfilter.org>

On 24.01.2011 14:25, Pablo Neira Ayuso wrote:
> On 24/01/11 14:12, Eric Dumazet wrote:
>> Le lundi 24 janvier 2011 à 14:06 +0100, Pablo Neira Ayuso a écrit :
>>
>>> Yes, we can use nf_conntrack_get (which does atomic_inc) instead. New
>>> patch attached.
>>
>> I feel now a bit uncomfortable, sorry ;)
>>
>> Are we sure the refcount cannot reach 0 while we hold
>> nf_conntrack_lock ?
> 
> the ct deletion from the hash list is protected by spin lock, so
> whatever deletion would wait until we have left the dump section.
> 
> with this patch, the code looks like it was in 2.6.24 before the rcu stuff.

Yeah, we definitely have a reference while the conntrack is contained
in the hash table, and removal requires taking nf_conntrack_lock,
therefor using the conntrack entry while holding the lock is valid.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-01-24 13:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-23 23:16 [PATCH] netfilter: ctnetlink: fix (really) race condition between dump_table and destroy Pablo Neira Ayuso
2011-01-24  6:41 ` Eric Dumazet
2011-01-24  7:04   ` Eric Dumazet
2011-01-24 11:57   ` Pablo Neira Ayuso
2011-01-24 12:46     ` Patrick McHardy
2011-01-24 12:54       ` Eric Dumazet
2011-01-24 13:06         ` Pablo Neira Ayuso
2011-01-24 13:12           ` Eric Dumazet
2011-01-24 13:25             ` Pablo Neira Ayuso
2011-01-24 13:37               ` Patrick McHardy [this message]
2011-01-24 14:06                 ` Eric Dumazet
2011-01-24 17:53                   ` Patrick McHardy
2011-01-24 18:01                     ` Eric Dumazet
2011-01-24 18:16                       ` Patrick McHardy
2011-02-20 20:48 ` Stephen Hemminger
2011-02-20 20:51   ` [PATCH 1/2] netfilter: fix race in conntrack " Stephen Hemminger
2011-02-20 20:51   ` [PATCH 2/2] netfilter: ctnetlink: fix missing refcount increment during dumps Stephen Hemminger

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=4D3D809F.30808@trash.net \
    --to=kaber@trash.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=shemminger@vyatta.com \
    /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).