[DCCP]: fix theoretical ccids_{read,write}_lock() race
authorOleg Nesterov <oleg@tv-sign.ru>
Fri, 10 Aug 2007 22:21:17 +0000 (15:21 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Tue, 14 Aug 2007 05:52:09 +0000 (22:52 -0700)
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: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dccp/ccid.c

index ccbf72c793b6c61381b40d466073a89f2bfb4575..c45088b5e6fb68f5c8a453561453061dee512d54 100644 (file)
@@ -40,6 +40,7 @@ static inline void ccids_write_unlock(void)
 static inline void ccids_read_lock(void)
 {
        atomic_inc(&ccids_lockct);
+       smp_mb__after_atomic_inc();
        spin_unlock_wait(&ccids_lock);
 }