[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPWQB7H0qdi2+rL92_O=-ku+FeqDSGEmn+d0wivk-1RSAsgeFw@mail.gmail.com>
Date: Fri, 6 May 2016 12:38:44 -0700
From: Joe Stringer <joe@....org>
To: Pablo Neira Ayuso <pablo@...filter.org>
Cc: netdev <netdev@...r.kernel.org>, netfilter-devel@...r.kernel.org,
Florian Westphal <fw@...len.de>
Subject: Re: [PATCH net] netfilter: nf_conntrack: Use net_mutex for helper unregistration.
On 6 May 2016 at 04:03, Pablo Neira Ayuso <pablo@...filter.org> wrote:
> Hi Joe,
>
> On Thu, May 05, 2016 at 03:50:37PM -0700, Joe Stringer wrote:
>> diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
>> index 3b40ec575cd5..6860b19be406 100644
>> --- a/net/netfilter/nf_conntrack_helper.c
>> +++ b/net/netfilter/nf_conntrack_helper.c
>> @@ -449,10 +449,10 @@ void nf_conntrack_helper_unregister(struct nf_conntrack_helper *me)
>> */
>> synchronize_rcu();
>>
>> - rtnl_lock();
>> + mutex_lock(&net_mutex);
>> for_each_net(net)
>> __nf_conntrack_helper_unregister(me, net);
>> - rtnl_unlock();
>> + mutex_unlock(&net_mutex);
>
> This simple solution works because we have no .exit callbacks in any
> of our helpers. Otherwise, the helper code may be already gone by when
> the worker has a chance to run to release the netns.
I'm open to any alternative solutions, but if helper code isn't doing
this yet then perhaps this fix is sufficient?
> If so, probably I can append this as comment to this function so we
> don't forget. If we ever have .exit callbacks (I don't expect so), we
> would need to wait for worker completion.
Sounds reasonable to me.
I see there's a bunch of other unregister locations like
nf_nat_l3proto_clean(), nf_nat_l4proto_clean(), nf_unregister_hook()
which might need similar treatment?
Powered by blists - more mailing lists