netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>,
	Marcel Holtmann <marcel@holtmann.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 064/177] Bluetooth: hci_core: fix init for HCI_USER_CHANNEL
Date: Tue, 10 Dec 2019 16:30:28 -0500	[thread overview]
Message-ID: <20191210213221.11921-64-sashal@kernel.org> (raw)
In-Reply-To: <20191210213221.11921-1-sashal@kernel.org>

From: Mattijs Korpershoek <mkorpershoek@baylibre.com>

[ Upstream commit eb8c101e28496888a0dcfe16ab86a1bee369e820 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/bluetooth/hci_core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index e0de9a609265a..e03faca84919e 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -4330,7 +4330,14 @@ static void hci_rx_work(struct work_struct *work)
 			hci_send_to_sock(hdev, skb);
 		}
 
-		if (hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) {
+		/* 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 (hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
+		    !test_bit(HCI_INIT, &hdev->flags)) {
 			kfree_skb(skb);
 			continue;
 		}
-- 
2.20.1


  parent reply	other threads:[~2019-12-10 21:43 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191210213221.11921-1-sashal@kernel.org>
2019-12-10 21:29 ` [PATCH AUTOSEL 4.19 011/177] rtlwifi: prevent memory leak in rtl_usb_probe Sasha Levin
2019-12-10 21:29 ` [PATCH AUTOSEL 4.19 012/177] libertas: fix a potential NULL pointer dereference Sasha Levin
2019-12-10 21:29 ` [PATCH AUTOSEL 4.19 013/177] ath10k: fix backtrace on coredump Sasha Levin
2019-12-10 21:29 ` [PATCH AUTOSEL 4.19 023/177] ath10k: fix offchannel tx failure when no ath10k_mac_tx_frm_has_freq Sasha Levin
2019-12-10 21:29 ` [PATCH AUTOSEL 4.19 026/177] selftests/bpf: Correct path to include msg + path Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 038/177] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 054/177] ath10k: Correct error handling of dma_map_single() Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 062/177] Bluetooth: missed cpu_to_le16 conversion in hci_init4_req Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 063/177] Bluetooth: Workaround directed advertising bug in Broadcom controllers Sasha Levin
2019-12-10 21:30 ` Sasha Levin [this message]
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 065/177] bpf/stackmap: Fix deadlock with rq_lock in bpf_get_stack() Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 071/177] rtl8xxxu: fix RTL8723BU connection failure issue after warm reboot Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 077/177] i40e: initialize ITRN registers with correct values Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 078/177] net: phy: dp83867: enable robust auto-mdix Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 085/177] net: dsa: LAN9303: select REGMAP when LAN9303 enable Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 090/177] net: hns3: add struct netdev_queue debug info for TX timeout Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 096/177] libbpf: Fix error handling in bpf_map__reuse_fd() Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 097/177] Bluetooth: Fix advertising duplicated flags Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 099/177] ixgbe: protect TX timestamping from API misuse Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 103/177] rfkill: allocate static minor Sasha Levin
2019-12-11  7:52   ` Greg Kroah-Hartman
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 104/177] bnx2x: Fix PF-VF communication over multi-cos queues Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 107/177] rtlwifi: fix memory leak in rtl92c_set_fw_rsvdpagepkt() Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 117/177] perf tools: Splice events onto evlist even on error Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 121/177] perf parse: If pmu configuration fails free terms Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 127/177] ath10k: fix get invalid tx rate for Mesh metric Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 132/177] ice: delay less Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 141/177] net: bcmgenet: Add RGMII_RXID support Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 150/177] iwlwifi: mvm: fix unaligned read of rx_pkt_status Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 153/177] tun: fix data-race in gro_normal_list() Sasha Levin
2019-12-10 21:32 ` [PATCH AUTOSEL 4.19 163/177] brcmfmac: remove monitor interface when detaching Sasha Levin
2019-12-10 21:32 ` [PATCH AUTOSEL 4.19 164/177] iwlwifi: check kasprintf() return value Sasha Levin
2019-12-10 21:32 ` [PATCH AUTOSEL 4.19 166/177] net: ethernet: ti: ale: clean ale tbl on init and intf restart Sasha Levin
2019-12-10 21:32 ` [PATCH AUTOSEL 4.19 170/177] mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED Sasha Levin
2019-12-10 21:32 ` [PATCH AUTOSEL 4.19 177/177] net: phy: initialise phydev speed and duplex sanely Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191210213221.11921-64-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=mkorpershoek@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).