ipv4: Add a missing rcu_assign_pointer() in routing cache.
authorEric Dumazet <dada1@cosmosbay.com>
Thu, 16 Oct 2008 21:18:29 +0000 (14:18 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 16 Oct 2008 21:18:29 +0000 (14:18 -0700)
rt_intern_hash() is doing an update of a RCU guarded hash chain
without using rcu_assign_pointer() or equivalent barrier.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/route.c

index a6d7c584f53b9a4f7493ac3b73b2e4b2602f66bf..8d23cc7efbadd4efdaa58b3a9a53eb598a97595f 100644 (file)
@@ -1109,7 +1109,12 @@ restart:
                printk("\n");
        }
 #endif
-       rt_hash_table[hash].chain = rt;
+       /*
+        * Since lookup is lockfree, we must make sure
+        * previous writes to rt are comitted to memory
+        * before making rt visible to other CPUS.
+        */
+       rcu_assign_pointer(rt_hash_table[hash].chain, rt);
        spin_unlock_bh(rt_hash_lock_addr(hash));
        *rp = rt;
        return 0;