| From | Ben Hutchings <> | Date | Sat, 08 Feb 2020 18:19:28 +0000 | Subject | [PATCH 3.16 029/148] Bluetooth: hci_core: fix init for HCI_USER_CHANNEL |
| |
3.16.82-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
commit eb8c101e28496888a0dcfe16ab86a1bee369e820 upstream.
During the setup() stage, HCI device drivers expect the chip to acknowledge its setup() completion via vendor specific frames.
If userspace opens() such HCI device in HCI_USER_CHANNEL [1] mode, the vendor specific frames are never tranmitted to the driver, as they are filtered in hci_rx_work().
Allow HCI devices which operate in HCI_USER_CHANNEL mode to receive frames if the HCI device is is HCI_INIT state.
[1] https://www.spinics.net/lists/linux-bluetooth/msg37345.html
Fixes: 23500189d7e0 ("Bluetooth: Introduce new HCI socket channel for user operation") Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org> [bwh: Backported to 3.16: Keep checking both HCI_RAW and HCI_USER_CHANNEL bits here] Signed-off-by: Ben Hutchings <ben@decadent.org.uk> --- --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -5226,8 +5226,15 @@ static void hci_rx_work(struct work_stru hci_send_to_sock(hdev, skb); } - if (test_bit(HCI_RAW, &hdev->flags) || - test_bit(HCI_USER_CHANNEL, &hdev->dev_flags)) { + /* If the device has been opened in HCI_USER_CHANNEL, + * the userspace has exclusive access to device. + * When device is HCI_INIT, we still need to process + * the data packets to the driver in order + * to complete its setup(). + */ + if ((test_bit(HCI_RAW, &hdev->flags) || + test_bit(HCI_USER_CHANNEL, &hdev->dev_flags)) && + !test_bit(HCI_INIT, &hdev->flags)) { kfree_skb(skb); continue; }
|