From: Oleg Nesterov Date: Fri, 10 Aug 2007 22:21:17 +0000 (-0700) Subject: [DCCP]: fix theoretical ccids_{read,write}_lock() race X-Git-Tag: v2.6.23-rc4~137^2~6 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=d725fdc8027a4cd961f58d92917fbb91b171abfa;p=linux-2.6-omap-h63xx.git [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: Oleg Nesterov Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- diff --git a/net/dccp/ccid.c b/net/dccp/ccid.c index ccbf72c793b..c45088b5e6f 100644 --- a/net/dccp/ccid.c +++ b/net/dccp/ccid.c @@ -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); }