Skip to contentSkip to conversation

fix theoretical ccids_{read,write}_lock() race

PATCH Applied [email protected] 2 participants 2 messages Aug 10, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 11/28 fix theoretical ccids_{read,write}_lock() race

From: Oleg Nesterov <[email protected]>

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

(akpm: can't we convert this code to use rwlocks?)

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "David S. Miller" <[email protected]>

---

 net/dccp/ccid.c |    1 +
 1 files changed, 1 insertion(+)
net/dccp/ccid.c renamed from net/dccp/ccid.c~fix-theoretical-ccids_readwrite_lock-race +1 -0
diff -puN net/dccp/ccid.c~fix-theoretical-ccids_readwrite_lock-race net/dccp/ccid.c
@@ -40,6 +40,7 @@ static inline void ccids_write_unlock(vo
 static inline void ccids_read_lock(void)
 {
 	atomic_inc(&ccids_lockct);
+	smp_mb__after_atomic_inc();
 	spin_unlock_wait(&ccids_lock);
 }
 

_

maintainer Applied
#1 lore raw

From: [email protected]
Date: Fri, 10 Aug 2007 14:11:55 -0700

Quoted 11 lines

From: Oleg Nesterov <[email protected]>

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

(akpm: can't we convert this code to use rwlocks?)

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "David S. Miller" <[email protected]>

Applied to net-2.6, thanks!