summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2008-10-16 23:18:29 +0200
committerDavid S. Miller <davem@davemloft.net>2008-10-16 23:18:29 +0200
commit00269b54edbf25f3bb0dccb558ae23a6fc77ed86 (patch)
tree63eb993fc8c463c5f6d023961b61b9dbaccd82cc /net
parent[netdrvr] ibmtr: PCMCIA IBMTR is ok on 64bit (diff)
downloadlinux-00269b54edbf25f3bb0dccb558ae23a6fc77ed86.tar.xz
linux-00269b54edbf25f3bb0dccb558ae23a6fc77ed86.zip
ipv4: Add a missing rcu_assign_pointer() in routing cache.
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>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/route.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a6d7c584f53b..8d23cc7efbad 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -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;