Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751751AbaAIVIB (ORCPT ); Thu, 9 Jan 2014 16:08:01 -0500 Received: from relay.parallels.com ([195.214.232.42]:57106 "EHLO relay.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752543AbaAIVHy (ORCPT ); Thu, 9 Jan 2014 16:07:54 -0500 Date: Fri, 10 Jan 2014 01:07:49 +0400 From: Andrew Vagin To: Florian Westphal CC: Eric Dumazet , Andrey Vagin , , , , , , , Pablo Neira Ayuso , Patrick McHardy , Jozsef Kadlecsik , "David S. Miller" , "Cyrill Gorcunov" Subject: Re: [PATCH] netfilter: nf_conntrack: fix RCU race in nf_conntrack_find_get Message-ID: <20140109210749.GA29440@paralelels.com> References: <1389090711-15843-1-git-send-email-avagin@openvz.org> <1389107305.26646.20.camel@edumazet-glaptop2.roam.corp.google.com> <20140107152520.GF9894@breakpoint.cc> <20140109203206.GA26348@paralelels.com> <20140109205622.GA29458@breakpoint.cc> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Disposition: inline In-Reply-To: <20140109205622.GA29458@breakpoint.cc> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [10.24.24.156] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 09, 2014 at 09:56:22PM +0100, Florian Westphal wrote: > Andrew Vagin wrote: > > Can we allocate conntrack with zero ct_general.use and increment it at > > the first time before inserting the conntrack into the hash table? > > When conntrack is allocated it is attached exclusively to one skb. > > It must be destroyed with skb, if it has not been confirmed, so we > > don't need refcnt on this stage. > > > > I found only one place, where a reference counter of unconfirmed > > conntract can incremented. It's ctnetlink_dump_table(). > > What about skb_clone, etc? They will also increment the refcnt > if a conntrack entry is attached to the skb. We can not attach an unconfirmed conntrack to a few skb, because nf_nat_setup_info can be executed concurrently for the same conntrack. How do we avoid this race condition for cloned skb-s? -- 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/