From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 14 Oct 2011 15:03:41 -0300 From: Gustavo Padovan To: Szymon Janc Cc: linux-bluetooth@vger.kernel.org, par-gunnar.p.hjalmdahl@stericsson.com, ulrik.lauren@stericsson.com, henrik.possung@stericsson.com Subject: Re: [PATCH] Bluetooth: rfcomm: Fix sleep in invalid context in rfcomm_security_cfm Message-ID: <20111014180341.GA30989@joana> References: <1317039587-22992-1-git-send-email-szymon.janc@tieto.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1317039587-22992-1-git-send-email-szymon.janc@tieto.com> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Szymon, * Szymon Janc [2011-09-26 14:19:47 +0200]: > This was triggered by turning off encryption on ACL link when rfcomm > was using high security. rfcomm_security_cfm (which is called from rx > task) was closing DLC and this involves sending disconnect message > (and locking socket). > > Move closing DLC to rfcomm_process_dlcs and only flag DLC for closure > in rfcomm_security_cfm. > > BUG: sleeping function called from invalid context at net/core/sock.c:2032 > in_atomic(): 1, irqs_disabled(): 0, pid: 1788, name: kworker/0:3 > [] (unwind_backtrace+0x0/0x108) from [] (dump_stack+0x20/0x24) > [] (dump_stack+0x20/0x24) from [] (__might_sleep+0x110/0x12c) > [] (__might_sleep+0x110/0x12c) from [] (lock_sock_nested+0x2c/0x64) > [] (lock_sock_nested+0x2c/0x64) from [] (l2cap_sock_sendmsg+0x58/0xcc) > [] (l2cap_sock_sendmsg+0x58/0xcc) from [] (sock_sendmsg+0xb0/0xd0) > [] (sock_sendmsg+0xb0/0xd0) from [] (kernel_sendmsg+0x3c/0x44) > [] (kernel_sendmsg+0x3c/0x44) from [] (rfcomm_send_frame+0x50/0x58) > [] (rfcomm_send_frame+0x50/0x58) from [] (rfcomm_send_disc+0x78/0x80) > [] (rfcomm_send_disc+0x78/0x80) from [] (__rfcomm_dlc_close+0x2d0/0x2fc) > [] (__rfcomm_dlc_close+0x2d0/0x2fc) from [] (rfcomm_security_cfm+0x140/0x1e0) > [] (rfcomm_security_cfm+0x140/0x1e0) from [] (hci_event_packet+0x1ce8/0x4d84) > [] (hci_event_packet+0x1ce8/0x4d84) from [] (hci_rx_task+0x1d0/0x2d0) > [] (hci_rx_task+0x1d0/0x2d0) from [] (tasklet_action+0x138/0x1e4) > [] (tasklet_action+0x138/0x1e4) from [] (__do_softirq+0xcc/0x274) > [] (__do_softirq+0xcc/0x274) from [] (do_softirq+0x60/0x6c) > [] (do_softirq+0x60/0x6c) from [] (local_bh_enable_ip+0xc8/0xd4) > [] (local_bh_enable_ip+0xc8/0xd4) from [] (_raw_spin_unlock_bh+0x48/0x4c) > [] (_raw_spin_unlock_bh+0x48/0x4c) from [] (data_from_chip+0xf4/0xaec) > [] (data_from_chip+0xf4/0xaec) from [] (send_skb_to_core+0x40/0x178) > [] (send_skb_to_core+0x40/0x178) from [] (cg2900_hu_receive+0x15c/0x2d0) > [] (cg2900_hu_receive+0x15c/0x2d0) from [] (hci_uart_tty_receive+0x74/0xa0) > [] (hci_uart_tty_receive+0x74/0xa0) from [] (flush_to_ldisc+0x188/0x198) > [] (flush_to_ldisc+0x188/0x198) from [] (process_one_work+0x144/0x4b8) > [] (process_one_work+0x144/0x4b8) from [] (worker_thread+0x198/0x468) > [] (worker_thread+0x198/0x468) from [] (kthread+0x98/0xa0) > [] (kthread+0x98/0xa0) from [] (kernel_thread_exit+0x0/0x8) > > Signed-off-by: Szymon Janc > --- > include/net/bluetooth/rfcomm.h | 1 + > net/bluetooth/rfcomm/core.c | 9 +++++++-- > 2 files changed, 8 insertions(+), 2 deletions(-) Applied, thanks. Gustavo