linux/drivers/bluetooth
Dean Jenkins 048e1bd3a2 Bluetooth: hci_ldisc: Add protocol check to hci_uart_dequeue()
Before attempting to dequeue a Data Link protocol encapsulated message,
check that the Data Link protocol is still bound to the HCI UART driver.
This makes the code consistent with the usage of the other proto
function pointers.

Therefore, add a check for HCI_UART_PROTO_READY into hci_uart_dequeue()
and return NULL if the Data Link protocol is not bound.

This is needed for robustness as there is a scheduling race condition.
hci_uart_write_work() is scheduled to run via work queue hu->write_work
from hci_uart_tx_wakeup(). Therefore, there is a delay between
scheduling hci_uart_write_work() to run and hci_uart_dequeue() running
whereby the Data Link protocol layer could become unbound during the
scheduling delay. In this case, without the check, the call to the
unbound Data Link protocol layer dequeue function can crash.

It is noted that hci_uart_tty_close() has a
"cancel_work_sync(&hu->write_work)" statement but this only reduces
the window of the race condition because it is possible for a new
work-item to be added to work queue hu->write_work after the call to
cancel_work_sync(). For example, Data Link layer retransmissions can
be added to the work queue after the cancel_work_sync() has finished.

Signed-off-by: Dean Jenkins <Dean_Jenkins@mentor.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2017-04-30 12:22:14 +02:00
..
ath3k.c Bluetooth: Add another AR3012 04ca:3018 device 2017-02-16 17:35:23 +01:00
bcm203x.c bluetooth: bcm203x: don't print error when allocating urb fails 2016-09-27 12:20:17 +02:00
bfusb.c Bluetooth: bfusb: Fix the return error code 2015-12-22 15:25:33 +01:00
bluecard_cs.c Bluetooth: bluecard: use setup_timer 2017-04-12 22:02:37 +02:00
bpa10x.c Bluetooth: bpa10x: Add support for hci_set_fw_info 2016-07-18 09:33:56 +03:00
bt3c_cs.c Bluetooth: Use new hci_skb_pkt_* wrappers for drivers 2015-11-19 17:50:27 +01:00
btbcm.c Bluetooth: btbcm: Add a delay for module reset 2017-02-16 17:32:25 +01:00
btbcm.h Bluetooth: btbcm: Support the BCM4354 Bluetooth UART device 2015-06-17 18:56:53 +02:00
btintel.c Bluetooth: btintel: Create common Intel Version Read function 2015-12-10 00:51:51 +01:00
btintel.h Bluetooth: btintel: Create common Intel Version Read function 2015-12-10 00:51:51 +01:00
btmrvl_debugfs.c Bluetooth: btmrvl add firmware dump support 2014-12-03 17:35:51 +01:00
btmrvl_drv.h Bluetooth: btmrvl: drop duplicate header slab.h 2016-12-08 07:44:56 +01:00
btmrvl_main.c Bluetooth: btmrvl: fix spelling mistake: "caibration" -> "calibration" 2017-02-16 17:38:51 +01:00
btmrvl_sdio.c Bluetooth: btmrvl: remove unnecessary wakeup interrupt number sanity check 2017-04-12 22:02:40 +02:00
btmrvl_sdio.h btmrvl: add platform specific wakeup interrupt support 2016-05-02 19:26:15 +02:00
btqca.c Bluetooth: btqca: remove null checks on edl->data as it is an array 2016-09-19 20:19:34 +02:00
btqca.h Bluetooth: btqca: Introduce generic QCA ROME support 2015-08-10 23:52:20 +02:00
btqcomsmd.c soc: qcom: smd: Transition client drivers from smd to rpmsg 2017-03-28 17:58:07 -07:00
btrtl.c Bluetooth: btrtl: Change message for missing config file 2017-04-12 22:02:38 +02:00
btrtl.h Bluetooth: btrtl: Create separate module for Realtek BT driver 2015-05-14 12:04:12 +02:00
btsdio.c Bluetooth: Rename HCI_BREDR into HCI_PRIMARY 2016-07-09 21:37:13 +03:00
btuart_cs.c Bluetooth: Use new hci_skb_pkt_* wrappers for drivers 2015-11-19 17:50:27 +01:00
btusb.c Bluetooth: btusb: wake system up when receives a wake irq 2017-04-12 22:02:38 +02:00
btwilink.c Bluetooth: btwilink: Fix probe return value 2016-10-20 10:14:49 +02:00
dtl1_cs.c Bluetooth: Use new hci_skb_pkt_* wrappers for drivers 2015-11-19 17:50:27 +01:00
hci_ag6xx.c Bluetooth: hci_uart: Add diag and address support for Intel/AG6xx 2016-02-29 19:25:22 +02:00
hci_ath.c Bluetooth: Use new hci_skb_pkt_* wrappers for drivers 2015-11-19 17:50:27 +01:00
hci_bcm.c Bluetooth: hci_bcm: add missing tty-device sanity check 2017-04-12 22:02:39 +02:00
hci_bcsp.c Bluetooth: hci_bcsp: Use setup_timer Kernel API instead of init_timer 2016-11-27 07:41:05 +01:00
hci_h4.c Bluetooth: hci_uart: add support for word alignment 2017-04-12 22:12:17 +02:00
hci_h5.c Bluetooth: hci_h5: Use setup_timer Kernel API instead of init_timer 2016-11-27 07:41:05 +01:00
hci_intel.c Bluetooth: hci_intel: add missing tty-device sanity check 2017-04-12 22:02:39 +02:00
hci_ldisc.c Bluetooth: hci_ldisc: Add protocol check to hci_uart_dequeue() 2017-04-30 12:22:14 +02:00
hci_ll.c Bluetooth: hci_ll: Fix NULL pointer deref on FW upload failure 2017-04-22 10:28:40 +02:00
hci_mrvl.c Bluetooth: hci_uart: Add Marvell support 2016-09-19 20:32:03 +02:00
hci_nokia.c Bluetooth: Add module license for HCI UART Nokia H4+ 2017-04-30 12:22:14 +02:00
hci_qca.c Bluetooth: hci_qca: fix spelling mistake: "Spurrious" -> "Spurious" 2017-02-18 20:09:47 +01:00
hci_serdev.c Bluetooth: hci_serdev: allow modular drivers 2017-04-12 22:12:17 +02:00
hci_uart.h bluetooth: hci_uart: remove unused hci_uart_init_tty 2017-04-13 19:22:53 +02:00
hci_vhci.c [iov_iter] new primitives - copy_from_iter_full() and friends 2016-12-05 14:33:36 -05:00
Kconfig Bluetooth: try to improve CONFIG_SERIAL_DEV_BUS dependency 2017-04-22 10:28:40 +02:00
Makefile Bluetooth: try to improve CONFIG_SERIAL_DEV_BUS dependency 2017-04-22 10:28:40 +02:00