Re: [PATCH 02/17] netfilter: nat: remove module reference counting from NAT protocols
From: Eric Dumazet <hidden>
Date: 2011-11-21 07:36:37
Also in:
netfilter-devel
Le lundi 21 novembre 2011 à 06:45 +0100, kaber@trash.net a écrit :
From: Patrick McHardy <redacted> 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 <redacted>
quoted hunk ↗ jump to hunk
@@ -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 netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html