All of lore.kernel.org
 help / color / mirror / Atom feed
From: Deepak Saxena <dsaxena@plexity.net>
To: samuel@sortiz.org
Cc: netdev@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	Ingo Molnar <mingo@elte.hu>, Daniel Walker <dwalker@mvista.com>
Subject: [PATCH -rt] Fix initialization of spinlock in irttp_dup()
Date: Tue, 20 Mar 2007 12:22:33 -0700	[thread overview]
Message-ID: <20070320192233.GA14543@plexity.net> (raw)

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

             reply	other threads:[~2007-03-20 20:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-20 19:22 Deepak Saxena [this message]
2007-03-20 21:50 ` [PATCH -rt] Fix initialization of spinlock in irttp_dup() Samuel Ortiz
2007-03-21  7:11 ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070320192233.GA14543@plexity.net \
    --to=dsaxena@plexity.net \
    --cc=akpm@osdl.org \
    --cc=dwalker@mvista.com \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=samuel@sortiz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.