Re: [PATCH 02/17] netfilter: nat: remove module reference counting from NAT protocols

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/21/2011 08:36 AM, Eric Dumazet wrote:
Le lundi 21 novembre 2011 à 06:45 +0100, kaber@xxxxxxxxx a écrit :
From: Patrick McHardy<kaber@xxxxxxxxx>

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@xxxxxxxxx>
@@ -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)

I'll update the changelog for the next submission.


  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 :-

Yeah, it doesn't belong into this patch.

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux