netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -rt] Fix initialization of spinlock in irttp_dup()
@ 2007-03-20 19:22 Deepak Saxena
  2007-03-20 21:50 ` Samuel Ortiz
  2007-03-21  7:11 ` Ingo Molnar
  0 siblings, 2 replies; 3+ messages in thread
From: Deepak Saxena @ 2007-03-20 19:22 UTC (permalink / raw)
  To: samuel; +Cc: netdev, Andrew Morton, Ingo Molnar, Daniel Walker

This was found around the 2.6.10 timeframe when testing with the -rt patch
and I believe is still is an issue. irttp_dup() does a memcpy() of the tsap_cb 
structure causing the spinlock protecting various fields in the structure to be 
duped.  This works OK in the non-RT case but in the RT case we end up with two 
mutexes pointing to the same wait_list and leading to an OOPS. Fix is to simply
initialize the spinlock after the memcpy().

Signed-off-by: Deepak Saxena <dsaxena@mvista.com>

diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index a7486b3..df2b2f7 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -1441,6 +1441,7 @@ struct tsap_cb *irttp_dup(struct tsap_cb
 	}
 	/* Dup */
 	memcpy(new, orig, sizeof(struct tsap_cb));
+	spin_lock_init(&new->lock);
 
 	/* We don't need the old instance any more */
 	spin_unlock_irqrestore(&irttp->tsaps->hb_spinlock, flags);


-- 
Deepak Saxena - dsaxena@plexity.net - http://www.plexity.net

In the end, they will not say, "those were dark times,"  they will ask
"why were their poets silent?" - Bertolt Brecht

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-03-21  7:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-20 19:22 [PATCH -rt] Fix initialization of spinlock in irttp_dup() Deepak Saxena
2007-03-20 21:50 ` Samuel Ortiz
2007-03-21  7:11 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).