Return-Path: Date: Sat, 3 Oct 2009 15:06:22 +0800 From: Dave Young To: Oliver Hartkopp Cc: Marcel Holtmann , Linux Netdev List , linux-bluetooth@vger.kernel.org Subject: Re: [BUG net-2.6] bluetooth/rfcomm : sleeping function called from invalid context at mm/slub.c:1719 Message-ID: <20091003070622.GA4110@darkstar> References: <4AC59D8A.6000102@hartkopp.net> <4AC6247E.7050308@hartkopp.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <4AC6247E.7050308@hartkopp.net> List-ID: On Fri, Oct 02, 2009 at 06:04:14PM +0200, Oliver Hartkopp wrote: > Dave Young wrote: > > On Fri, Oct 2, 2009 at 2:28 PM, Oliver Hartkopp wrote: > >> Hello Marcel, > >> > >> with current net-2.6 tree ... > >> > >> While starting my PPP Bluetooth dialup networking, i got this: > > > > Hi, oliver > > > > please try following patch: > > http://patchwork.kernel.org/patch/51326/ > > Hi Dave, > > that fixed it at ppp startup! > > Tested-by: Oliver Hartkopp > > Btw. when shutting down the ppp connection i still get this: > > [ 361.996887] INFO: trying to register non-static key. > [ 361.996897] the code is fine but needs lockdep annotation. > [ 361.996902] turning off the locking correctness validator. > [ 361.996912] Pid: 0, comm: swapper Not tainted 2.6.31-08939-gdb8abec-dirty #22 > [ 361.996919] Call Trace: > [ 361.996933] [] ? printk+0xf/0x11 > [ 361.996947] [] register_lock_class+0x5a/0x295 > [ 361.996957] [] __lock_acquire+0x9b/0xc03 > [ 361.996967] [] ? __lock_acquire+0xbf4/0xc03 > [ 361.996985] [] ? l2cap_get_chan_by_scid+0x35/0x43 [l2cap] > [ 361.996995] [] ? lock_release_non_nested+0x17b/0x1db > [ 361.997008] [] ? l2cap_get_chan_by_scid+0x35/0x43 [l2cap] > [ 361.997018] [] ? trace_hardirqs_off+0xb/0xd > [ 361.997028] [] lock_acquire+0x5c/0x73 > [ 361.997039] [] ? skb_dequeue+0x12/0x4c > [ 361.997049] [] _spin_lock_irqsave+0x24/0x34 > [ 361.997058] [] ? skb_dequeue+0x12/0x4c > [ 361.997066] [] skb_dequeue+0x12/0x4c > [ 361.997075] [] skb_queue_purge+0x14/0x1b > [ 361.997088] [] l2cap_recv_frame+0xe9e/0x129a [l2cap] > [ 361.997099] [] ? register_lock_class+0x17/0x295 > [ 361.997110] [] ? __lock_acquire+0xbf4/0xc03 > [ 361.997128] [] ? __lock_acquire+0xbf4/0xc03 > [ 361.997139] [] ? uhci_giveback_urb+0xf2/0x162 > [ 361.997163] [] ? hci_rx_task+0xfe/0x1f8 [bluetooth] > [ 361.997177] [] l2cap_recv_acldata+0xa9/0x1be [l2cap] > [ 361.997190] [] ? l2cap_recv_acldata+0x0/0x1be [l2cap] > [ 361.997208] [] hci_rx_task+0x130/0x1f8 [bluetooth] > [ 361.997219] [] tasklet_action+0x6b/0xb2 > [ 361.997228] [] __do_softirq+0x82/0x101 > [ 361.997237] [] do_softirq+0x2b/0x43 > [ 361.997246] [] irq_exit+0x35/0x68 > [ 361.997256] [] do_IRQ+0x80/0x96 > [ 361.997265] [] common_interrupt+0x2e/0x34 > [ 361.997275] [] ? tick_device_uses_broadcast+0x71/0x7c > [ 361.997286] [] ? acpi_idle_enter_simple+0x103/0x12e > [ 361.997296] [] acpi_idle_enter_bm+0xc3/0x253 > [ 361.997306] [] cpuidle_idle_call+0x60/0x91 > [ 361.997315] [] cpu_idle+0x49/0x65 > [ 361.997324] [] start_secondary+0x190/0x195 > > > Thanks, > Oliver > Oliver, does following patch fix the non-static lock problem? -- now l2cap conn locks will be initialized after setup l2cap conn timer, it will introduce following problem: [ 361.996887] INFO: trying to register non-static key. [ 361.996897] the code is fine but needs lockdep annotation. [ 361.996902] turning off the locking correctness validator. [ 361.996912] Pid: 0, comm: swapper Not tainted 2.6.31-08939-gdb8abec-dirty #22 [ 361.996919] Call Trace: [ 361.996933] [] ? printk+0xf/0x11 [ 361.996947] [] register_lock_class+0x5a/0x295 [ 361.996957] [] __lock_acquire+0x9b/0xc03 [ 361.996967] [] ? __lock_acquire+0xbf4/0xc03 [ 361.996985] [] ? l2cap_get_chan_by_scid+0x35/0x43 [l2cap] [ 361.996995] [] ? lock_release_non_nested+0x17b/0x1db [ 361.997008] [] ? l2cap_get_chan_by_scid+0x35/0x43 [l2cap] [ 361.997018] [] ? trace_hardirqs_off+0xb/0xd [ 361.997028] [] lock_acquire+0x5c/0x73 [ 361.997039] [] ? skb_dequeue+0x12/0x4c [ 361.997049] [] _spin_lock_irqsave+0x24/0x34 [ 361.997058] [] ? skb_dequeue+0x12/0x4c [ 361.997066] [] skb_dequeue+0x12/0x4c [ 361.997075] [] skb_queue_purge+0x14/0x1b [ 361.997088] [] l2cap_recv_frame+0xe9e/0x129a [l2cap] [ 361.997099] [] ? register_lock_class+0x17/0x295 [ 361.997110] [] ? __lock_acquire+0xbf4/0xc03 [ 361.997128] [] ? __lock_acquire+0xbf4/0xc03 [ 361.997139] [] ? uhci_giveback_urb+0xf2/0x162 [ 361.997163] [] ? hci_rx_task+0xfe/0x1f8 [bluetooth] [ 361.997177] [] l2cap_recv_acldata+0xa9/0x1be [l2cap] [ 361.997190] [] ? l2cap_recv_acldata+0x0/0x1be [l2cap] [ 361.997208] [] hci_rx_task+0x130/0x1f8 [bluetooth] [ 361.997219] [] tasklet_action+0x6b/0xb2 [ 361.997228] [] __do_softirq+0x82/0x101 [ 361.997237] [] do_softirq+0x2b/0x43 [ 361.997246] [] irq_exit+0x35/0x68 [ 361.997256] [] do_IRQ+0x80/0x96 [ 361.997265] [] common_interrupt+0x2e/0x34 [ 361.997275] [] ? tick_device_uses_broadcast+0x71/0x7c [ 361.997286] [] ? acpi_idle_enter_simple+0x103/0x12e [ 361.997296] [] acpi_idle_enter_bm+0xc3/0x253 [ 361.997306] [] cpuidle_idle_call+0x60/0x91 [ 361.997315] [] cpu_idle+0x49/0x65 [ 361.997324] [] start_secondary+0x190/0x195 Here move lock init things before setup_timer to avoid misuse uninitialized locks. Reported-by: Oliver Hartkopp Signed-off-by: Dave Young --- net/bluetooth/l2cap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- linux-2.6.31.orig/net/bluetooth/l2cap.c 2009-09-30 16:36:10.000000000 +0800 +++ linux-2.6.31/net/bluetooth/l2cap.c 2009-10-03 14:44:51.000000000 +0800 @@ -555,12 +555,12 @@ static struct l2cap_conn *l2cap_conn_add conn->feat_mask = 0; - setup_timer(&conn->info_timer, l2cap_info_timeout, - (unsigned long) conn); - spin_lock_init(&conn->lock); rwlock_init(&conn->chan_list.lock); + setup_timer(&conn->info_timer, l2cap_info_timeout, + (unsigned long) conn); + conn->disc_reason = 0x13; return conn;