From 700f9672c9a61c12334651a94d17ec04620e1976 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Tue, 21 Nov 2006 17:33:01 -0800 Subject: [PATCH] [IRDA]: Lockdep fix. On Sat, 2006-11-18 at 16:12 +0300, Andrey Borzenkov wrote: > ============================================= > [ INFO: possible recursive locking detected ] > 2.6.19-rc5-2avb #2 > - --------------------------------------------- > pppd/26425 is trying to acquire lock: > (&hashbin->hb_spinlock){....}, at: [] irlmp_slsap_inuse+0x5a/0x170 > [irda] > > but task is already holding lock: > (&hashbin->hb_spinlock){....}, at: [] irlmp_slsap_inuse+0x37/0x170 > [irda] > > other info that might help us debug this: > 1 lock held by pppd/26425: > #0: (&hashbin->hb_spinlock){....}, at: [] > irlmp_slsap_inuse+0x37/0x170 [irda] > > stack backtrace: > [] dump_trace+0x1cc/0x200 > [] show_trace_log_lvl+0x1a/0x30 > [] show_trace+0x12/0x20 > [] dump_stack+0x19/0x20 > [] __lock_acquire+0x8fa/0xc20 > [] lock_acquire+0x5d/0x80 > [] _spin_lock+0x2c/0x40 > [] irlmp_slsap_inuse+0x5a/0x170 [irda] > [] irlmp_open_lsap+0x62/0x180 [irda] > [] irttp_open_tsap+0x181/0x230 [irda] > [] ircomm_open_tsap+0x5d/0xa0 [ircomm] > [] ircomm_open+0xb8/0xd0 [ircomm] > [] ircomm_tty_open+0x4f7/0x570 [ircomm_tty] > [] tty_open+0x174/0x340 > [] chrdev_open+0x89/0x170 > [] __dentry_open+0xa6/0x1d0 > [] nameidata_to_filp+0x35/0x40 > [] do_filp_open+0x49/0x50 > [] do_sys_open+0x47/0xd0 > [] sys_open+0x1c/0x20 > [] sysenter_past_esp+0x56/0x8d > [] 0xb7f86410 > ======================= The comment at the nesting lock says: /* Careful for priority inversions here ! * irlmp->links is never taken while another IrDA * spinlock is held, so we are safe. Jean II */ So, under the assumption the author was right, it just needs a lockdep annotation. Signed-off-by: Peter Zijlstra Acked-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: David S. Miller --- net/irda/irlmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 5073261..fede837 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c @@ -1678,7 +1678,8 @@ static int irlmp_slsap_inuse(__u8 slsap_sel) * every IrLAP connection and check every LSAP associated with each * the connection. */ - spin_lock_irqsave(&irlmp->links->hb_spinlock, flags); + spin_lock_irqsave_nested(&irlmp->links->hb_spinlock, flags, + SINGLE_DEPTH_NESTING); lap = (struct lap_cb *) hashbin_get_first(irlmp->links); while (lap != NULL) { IRDA_ASSERT(lap->magic == LMP_LAP_MAGIC, goto errlap;); -- 2.7.4