Fix initialization of spinlock in irttp_dup()
Subsystems (2)
PATCH 1/1 Fix initialization of spinlock in irttp_dup()
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().
net/irda/irttp.c +1 -0
@@ -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);
Signature · 4 lines
Deepak Saxena - [email protected] - 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
Hi Deepak,
Quoted 6 lines · Deepak Saxena
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 amemcpy()of thetsap_cbstructure 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 samewait_listand leading to an OOPS. Fix is to simply initialize the spinlock after thememcpy().
This has just made it to the netdev and stable trees. See:
http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=7bb1bbe615de25d955b974cb47d40fa198154bb9
Cheers,
Samuel.
Quoted 21 lines
Signed-off-by Deepak Saxena <[email protected]>net/irda/irttp.c +1
-0@@ -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);Signature · 5 lines
-- Deepak Saxena - [email protected] - 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
Quoted 7 lines · Deepak Saxena
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 amemcpy()of thetsap_cbstructure 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 samewait_listand leading to an OOPS. Fix is to simply initialize the spinlock after thememcpy().
note that memcpy based lock initialization is a problem for lockdep too.
Ingo