mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
[NETFILTER]: nf_nat: properly use RCU for ip_nat_decode_session
We need to use rcu_assign_pointer/rcu_dereference to avoid races. Also remove an obsolete CONFIG_IP_NAT_NEEDED ifdef. Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
1e796fda00
commit
051578ccbc
2 changed files with 11 additions and 6 deletions
|
|
@ -332,7 +332,7 @@ static int __init nf_nat_standalone_init(void)
|
|||
|
||||
#ifdef CONFIG_XFRM
|
||||
BUG_ON(ip_nat_decode_session != NULL);
|
||||
ip_nat_decode_session = nat_decode_session;
|
||||
rcu_assign_pointer(ip_nat_decode_session, nat_decode_session);
|
||||
#endif
|
||||
ret = nf_nat_rule_init();
|
||||
if (ret < 0) {
|
||||
|
|
@ -350,7 +350,7 @@ static int __init nf_nat_standalone_init(void)
|
|||
nf_nat_rule_cleanup();
|
||||
cleanup_decode_session:
|
||||
#ifdef CONFIG_XFRM
|
||||
ip_nat_decode_session = NULL;
|
||||
rcu_assign_pointer(ip_nat_decode_session, NULL);
|
||||
synchronize_net();
|
||||
#endif
|
||||
return ret;
|
||||
|
|
@ -361,7 +361,7 @@ static void __exit nf_nat_standalone_fini(void)
|
|||
nf_unregister_hooks(nf_nat_ops, ARRAY_SIZE(nf_nat_ops));
|
||||
nf_nat_rule_cleanup();
|
||||
#ifdef CONFIG_XFRM
|
||||
ip_nat_decode_session = NULL;
|
||||
rcu_assign_pointer(ip_nat_decode_session, NULL);
|
||||
synchronize_net();
|
||||
#endif
|
||||
/* Conntrack caches are unregistered in nf_conntrack_cleanup */
|
||||
|
|
|
|||
Loading…
Reference in a new issue