linux/net/bluetooth
Jukka Taimisto 7ab56c3a6e Bluetooth: Fix deadlock in l2cap_conn_del()
A deadlock occurs when PDU containing invalid SMP opcode is received on
Security Manager Channel over LE link and conn->pending_rx_work worker
has not run yet.

When LE link is created l2cap_conn_ready() is called and before
returning it schedules conn->pending_rx_work worker to hdev->workqueue.
Incoming data to SMP fixed channel is handled by l2cap_recv_frame()
which calls smp_sig_channel() to handle the SMP PDU. If
smp_sig_channel() indicates failure l2cap_conn_del() is called to delete
the connection. When deleting the connection, l2cap_conn_del() purges
the pending_rx queue and calls flush_work() to wait for the
pending_rx_work worker to complete.

Since incoming data is handled by a worker running from the same
workqueue as the pending_rx_work is being scheduled on, we will deadlock
on waiting for pending_rx_work to complete.

This patch fixes the deadlock by calling cancel_work_sync() instead of
flush_work().

Signed-off-by: Jukka Taimisto <jtt@codenomicon.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org
2014-06-13 13:32:26 +02:00
..
bnep net/*: Fix FSF address in file headers 2013-12-06 12:37:57 -05:00
cmtp
hidp Merge branch 'for-3.15/hid-core-ll-transport-cleanup' into for-linus 2014-04-01 19:05:09 +02:00
rfcomm Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next 2014-05-29 13:03:47 -04:00
6lowpan.c Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next 2014-06-05 14:10:07 -04:00
6lowpan.h Bluetooth: make bluetooth 6lowpan as an option 2014-03-11 07:54:55 -07:00
a2mp.c Bluetooth: Convert uses of __constant_<foo> to <foo> 2014-03-12 11:10:17 -07:00
a2mp.h
af_bluetooth.c Bluetooth: Increase minor version of core module 2014-02-21 06:21:55 +02:00
amp.c
amp.h
hci_conn.c Bluetooth: Fix check for connection encryption 2014-06-13 13:30:39 +02:00
hci_core.c Bluetooth: Make SMP context private to smp.c 2014-05-20 08:44:11 -07:00
hci_event.c Bluetooth: Fix indicating discovery state when canceling inquiry 2014-06-13 13:32:16 +02:00
hci_sock.c net: add __pskb_copy_fclone and pskb_copy_for_clone 2014-06-11 15:38:02 -07:00
hci_sysfs.c Bluetooth: Convert to use ATTRIBUTE_GROUPS macro 2014-02-13 09:51:34 +02:00
Kconfig Bluetooth: make sure 6LOWPAN_IPHC is built-in if needed 2014-03-13 07:05:10 -07:00
l2cap_core.c Bluetooth: Fix deadlock in l2cap_conn_del() 2014-06-13 13:32:26 +02:00
l2cap_sock.c Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next 2014-06-05 14:10:07 -04:00
lib.c Bluetooth: Add error mapping for Directed Advertising Timeout 2014-03-26 09:31:36 -07:00
Makefile Bluetooth: make bluetooth 6lowpan as an option 2014-03-11 07:54:55 -07:00
mgmt.c Bluetooth: Reuse hci_stop_discovery function when cleaning up HCI state 2014-06-13 13:32:23 +02:00
sco.c net: Fix use after free by removing length arg from sk_data_ready callbacks. 2014-04-11 16:15:36 -04:00
smp.c Bluetooth: Fix setting correct authentication information for SMP STK 2014-06-13 13:30:48 +02:00
smp.h Bluetooth: Make SMP context private to smp.c 2014-05-20 08:44:11 -07:00