[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1321860997.17419.7.camel@edumazet-laptop>
Date: Mon, 21 Nov 2011 08:36:37 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: kaber@...sh.net
Cc: netfilter-devel@...r.kernel.org, netdev@...r.kernel.org,
ulrich.weber@...hos.com
Subject: Re: [PATCH 02/17] netfilter: nat: remove module reference counting
from NAT protocols
Le lundi 21 novembre 2011 à 06:45 +0100, kaber@...sh.net a écrit :
> From: Patrick McHardy <kaber@...sh.net>
>
> The only remaining user of NAT protocol module reference counting is NAT
> ctnetlink support. Since this is a fairly short sequence of code, convert
> over to use RCU and remove module reference counting.
>
> Signed-off-by: Patrick McHardy <kaber@...sh.net>
> @@ -612,16 +592,18 @@ static int nfnetlink_parse_nat_proto(struct nlattr *attr,
> if (err < 0)
> return err;
>
> - npt = nf_nat_proto_find_get(nf_ct_protonum(ct));
> + rcu_read_lock();
> + npt = __nf_nat_proto_find(nf_ct_protonum(ct));
> if (npt->nlattr_to_range)
> err = npt->nlattr_to_range(tb, range);
> - nf_nat_proto_put(npt);
> + rcu_read_unlock();
> return err;
> }
Seems good, but you should explain in changelog why its safe.
(Using rcu also means special action must be taken in the write side,
here the module removal)
>
> static const struct nla_policy nat_nla_policy[CTA_NAT_MAX+1] = {
> [CTA_NAT_MINIP] = { .type = NLA_U32 },
> [CTA_NAT_MAXIP] = { .type = NLA_U32 },
> + [CTA_NAT_PROTO] = { .type = NLA_NESTED },
> };
I just dont understand this part :-(
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists