[NETFILTER]: ip_conntrack: fix NAT helper unload races
[deliverable/linux.git] / net / ipv4 / netfilter / ip_nat_tftp.c
index 94a78015451c2fe5be8e91aba1a03b92d4c5b5d6..604793536fc13cce0f43320b6ef212bfb9f3012a 100644 (file)
@@ -55,15 +55,14 @@ static unsigned int help(struct sk_buff **pskb,
 
 static void __exit ip_nat_tftp_fini(void)
 {
-       ip_nat_tftp_hook = NULL;
-       /* Make sure noone calls it, meanwhile. */
-       synchronize_net();
+       rcu_assign_pointer(ip_nat_tftp_hook, NULL);
+       synchronize_rcu();
 }
 
 static int __init ip_nat_tftp_init(void)
 {
-       BUG_ON(ip_nat_tftp_hook);
-       ip_nat_tftp_hook = help;
+       BUG_ON(rcu_dereference(ip_nat_tftp_hook));
+       rcu_assign_pointer(ip_nat_tftp_hook, help);
        return 0;
 }
 
This page took 0.024845 seconds and 5 git commands to generate.