diff options
author | Florian Westphal <fw@strlen.de> | 2009-03-18 12:28:37 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2009-03-18 12:28:37 -0400 |
commit | cd91566e4bdbcb8841385e4b2eacc8d0c29c9208 (patch) | |
tree | 149c9a8d56f4ea7588f8e033337be9bbea5fc3fe /net | |
parent | 0269ea4937343536ec7e85649932bc8c9686ea78 (diff) |
netfilter: ctnetlink: remove remaining module refcounting
Convert the remaining refcount users.
As pointed out by Patrick McHardy, the protocols can be accessed safely using RCU.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nf_conntrack_netlink.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 9fb7cf7504fa..735ea9c1a96f 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -599,7 +599,8 @@ ctnetlink_parse_tuple_ip(struct nlattr *attr, struct nf_conntrack_tuple *tuple) | |||
599 | 599 | ||
600 | nla_parse_nested(tb, CTA_IP_MAX, attr, NULL); | 600 | nla_parse_nested(tb, CTA_IP_MAX, attr, NULL); |
601 | 601 | ||
602 | l3proto = nf_ct_l3proto_find_get(tuple->src.l3num); | 602 | rcu_read_lock(); |
603 | l3proto = __nf_ct_l3proto_find(tuple->src.l3num); | ||
603 | 604 | ||
604 | if (likely(l3proto->nlattr_to_tuple)) { | 605 | if (likely(l3proto->nlattr_to_tuple)) { |
605 | ret = nla_validate_nested(attr, CTA_IP_MAX, | 606 | ret = nla_validate_nested(attr, CTA_IP_MAX, |
@@ -608,7 +609,7 @@ ctnetlink_parse_tuple_ip(struct nlattr *attr, struct nf_conntrack_tuple *tuple) | |||
608 | ret = l3proto->nlattr_to_tuple(tb, tuple); | 609 | ret = l3proto->nlattr_to_tuple(tb, tuple); |
609 | } | 610 | } |
610 | 611 | ||
611 | nf_ct_l3proto_put(l3proto); | 612 | rcu_read_unlock(); |
612 | 613 | ||
613 | return ret; | 614 | return ret; |
614 | } | 615 | } |
@@ -633,7 +634,8 @@ ctnetlink_parse_tuple_proto(struct nlattr *attr, | |||
633 | return -EINVAL; | 634 | return -EINVAL; |
634 | tuple->dst.protonum = nla_get_u8(tb[CTA_PROTO_NUM]); | 635 | tuple->dst.protonum = nla_get_u8(tb[CTA_PROTO_NUM]); |
635 | 636 | ||
636 | l4proto = nf_ct_l4proto_find_get(tuple->src.l3num, tuple->dst.protonum); | 637 | rcu_read_lock(); |
638 | l4proto = __nf_ct_l4proto_find(tuple->src.l3num, tuple->dst.protonum); | ||
637 | 639 | ||
638 | if (likely(l4proto->nlattr_to_tuple)) { | 640 | if (likely(l4proto->nlattr_to_tuple)) { |
639 | ret = nla_validate_nested(attr, CTA_PROTO_MAX, | 641 | ret = nla_validate_nested(attr, CTA_PROTO_MAX, |
@@ -642,7 +644,7 @@ ctnetlink_parse_tuple_proto(struct nlattr *attr, | |||
642 | ret = l4proto->nlattr_to_tuple(tb, tuple); | 644 | ret = l4proto->nlattr_to_tuple(tb, tuple); |
643 | } | 645 | } |
644 | 646 | ||
645 | nf_ct_l4proto_put(l4proto); | 647 | rcu_read_unlock(); |
646 | 648 | ||
647 | return ret; | 649 | return ret; |
648 | } | 650 | } |
@@ -989,10 +991,11 @@ ctnetlink_change_protoinfo(struct nf_conn *ct, struct nlattr *cda[]) | |||
989 | 991 | ||
990 | nla_parse_nested(tb, CTA_PROTOINFO_MAX, attr, NULL); | 992 | nla_parse_nested(tb, CTA_PROTOINFO_MAX, attr, NULL); |
991 | 993 | ||
992 | l4proto = nf_ct_l4proto_find_get(nf_ct_l3num(ct), nf_ct_protonum(ct)); | 994 | rcu_read_lock(); |
995 | l4proto = __nf_ct_l4proto_find(nf_ct_l3num(ct), nf_ct_protonum(ct)); | ||
993 | if (l4proto->from_nlattr) | 996 | if (l4proto->from_nlattr) |
994 | err = l4proto->from_nlattr(tb, ct); | 997 | err = l4proto->from_nlattr(tb, ct); |
995 | nf_ct_l4proto_put(l4proto); | 998 | rcu_read_unlock(); |
996 | 999 | ||
997 | return err; | 1000 | return err; |
998 | } | 1001 | } |