diff options
author | Patrick McHardy <kaber@trash.net> | 2007-02-12 14:09:19 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-02-12 14:09:19 -0500 |
commit | c3a47ab3e5ad62601449e4e5401352271b777e28 (patch) | |
tree | 3b3f6810796367efa5f76209aed12bec6c6a8b17 /net/ipv4 | |
parent | ebaf0c6032f525ddb0158fb59848d41899dce8cd (diff) |
[NETFILTER]: Properly use RCU in nf_ct_attach
Use rcu_assign_pointer/rcu_dereference for ip_ct_attach pointer instead
of self-made RCU and use rcu_read_lock to make sure the conntrack module
doesn't disappear below us while calling it, since this function can be
called from outside the netfilter hooks.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c index 04e466d53c0b..508e6007a191 100644 --- a/net/ipv4/netfilter/ip_conntrack_core.c +++ b/net/ipv4/netfilter/ip_conntrack_core.c | |||
@@ -1354,7 +1354,7 @@ static void free_conntrack_hash(struct list_head *hash, int vmalloced,int size) | |||
1354 | supposed to kill the mall. */ | 1354 | supposed to kill the mall. */ |
1355 | void ip_conntrack_cleanup(void) | 1355 | void ip_conntrack_cleanup(void) |
1356 | { | 1356 | { |
1357 | ip_ct_attach = NULL; | 1357 | rcu_assign_pointer(ip_ct_attach, NULL); |
1358 | 1358 | ||
1359 | /* This makes sure all current packets have passed through | 1359 | /* This makes sure all current packets have passed through |
1360 | netfilter framework. Roll on, two-stage module | 1360 | netfilter framework. Roll on, two-stage module |
@@ -1515,7 +1515,7 @@ int __init ip_conntrack_init(void) | |||
1515 | write_unlock_bh(&ip_conntrack_lock); | 1515 | write_unlock_bh(&ip_conntrack_lock); |
1516 | 1516 | ||
1517 | /* For use by ipt_REJECT */ | 1517 | /* For use by ipt_REJECT */ |
1518 | ip_ct_attach = ip_conntrack_attach; | 1518 | rcu_assign_pointer(ip_ct_attach, ip_conntrack_attach); |
1519 | 1519 | ||
1520 | /* Set up fake conntrack: | 1520 | /* Set up fake conntrack: |
1521 | - to never be deleted, not in any hashes */ | 1521 | - to never be deleted, not in any hashes */ |