diff options
author | Patrick McHardy <kaber@trash.net> | 2007-02-12 11:12:40 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-02-12 11:12:40 -0800 |
commit | 642d628b2c92e5283bbd3c849c7099c64ab68856 (patch) | |
tree | 349ed55d878ce0a6ea8ac207d15a344d3d302aa3 /net/ipv4/netfilter/ip_conntrack_standalone.c | |
parent | e22a05486913ccb959281cd6370593bd8e197fa9 (diff) | |
download | linux-stable-642d628b2c92e5283bbd3c849c7099c64ab68856.tar.gz linux-stable-642d628b2c92e5283bbd3c849c7099c64ab68856.tar.bz2 linux-stable-642d628b2c92e5283bbd3c849c7099c64ab68856.zip |
[NETFILTER]: ip_conntrack: properly use RCU API for ip_ct_protos array
Replace preempt_{enable,disable} based RCU by proper use of the
RCU API and add missing rcu_read_lock/rcu_read_unlock calls in
all paths not obviously only used within packet process context
(nfnetlink_conntrack).
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/netfilter/ip_conntrack_standalone.c')
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_standalone.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c index 300ccbbbdac9..c7c1ec61b0f5 100644 --- a/net/ipv4/netfilter/ip_conntrack_standalone.c +++ b/net/ipv4/netfilter/ip_conntrack_standalone.c @@ -796,7 +796,7 @@ int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto) ret = -EBUSY; goto out; } - ip_ct_protos[proto->proto] = proto; + rcu_assign_pointer(ip_ct_protos[proto->proto], proto); out: write_unlock_bh(&ip_conntrack_lock); return ret; @@ -805,11 +805,10 @@ int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto) void ip_conntrack_protocol_unregister(struct ip_conntrack_protocol *proto) { write_lock_bh(&ip_conntrack_lock); - ip_ct_protos[proto->proto] = &ip_conntrack_generic_protocol; + rcu_assign_pointer(ip_ct_protos[proto->proto], + &ip_conntrack_generic_protocol); write_unlock_bh(&ip_conntrack_lock); - - /* Somebody could be still looking at the proto in bh. */ - synchronize_net(); + synchronize_rcu(); /* Remove all contrack entries for this protocol */ ip_ct_iterate_cleanup(kill_proto, &proto->proto); |