提交 00269b54 编写于 作者: E Eric Dumazet 提交者: David S. Miller

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: NEric Dumazet <dada1@cosmosbay.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 dc976c09
...@@ -1109,7 +1109,12 @@ static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp) ...@@ -1109,7 +1109,12 @@ static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp)
printk("\n"); printk("\n");
} }
#endif #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)); spin_unlock_bh(rt_hash_lock_addr(hash));
*rp = rt; *rp = rt;
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册