提交 d725fdc8 编写于 作者: O Oleg Nesterov 提交者: David S. Miller

[DCCP]: fix theoretical ccids_{read,write}_lock() race

Make sure that spin_unlock_wait() is properly ordered wrt atomic_inc().

(akpm: can't we convert this code to use rwlocks?)
Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b5890d8b
...@@ -40,6 +40,7 @@ static inline void ccids_write_unlock(void) ...@@ -40,6 +40,7 @@ static inline void ccids_write_unlock(void)
static inline void ccids_read_lock(void) static inline void ccids_read_lock(void)
{ {
atomic_inc(&ccids_lockct); atomic_inc(&ccids_lockct);
smp_mb__after_atomic_inc();
spin_unlock_wait(&ccids_lock); spin_unlock_wait(&ccids_lock);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册