aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorSoenke Huster <soenke.huster@eknoes.de>2022-01-14 17:44:02 +0100
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-01-14 12:20:49 -0800
commit3afee2118132e93e5f6fa636dfde86201a860ab3 (patch)
treeb3cd93800092b97a485f96f39576dbb2f13b913a /net/bluetooth/hci_event.c
parentBluetooth: hci_sync: unlock on error in hci_inquiry_result_with_rssi_evt() (diff)
downloadlinux-dev-3afee2118132e93e5f6fa636dfde86201a860ab3.tar.xz
linux-dev-3afee2118132e93e5f6fa636dfde86201a860ab3.zip
Bluetooth: fix null ptr deref on hci_sync_conn_complete_evt
This event is just specified for SCO and eSCO link types. On the reception of a HCI_Synchronous_Connection_Complete for a BDADDR of an existing LE connection, LE link type and a status that triggers the second case of the packet processing a NULL pointer dereference happens, as conn->link is NULL. Signed-off-by: Soenke Huster <soenke.huster@eknoes.de> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 05997dff5666..681c623aa380 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -4661,6 +4661,19 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, void *data,
struct hci_ev_sync_conn_complete *ev = data;
struct hci_conn *conn;
+ switch (ev->link_type) {
+ case SCO_LINK:
+ case ESCO_LINK:
+ break;
+ default:
+ /* As per Core 5.3 Vol 4 Part E 7.7.35 (p.2219), Link_Type
+ * for HCI_Synchronous_Connection_Complete is limited to
+ * either SCO or eSCO
+ */
+ bt_dev_err(hdev, "Ignoring connect complete event for invalid link type");
+ return;
+ }
+
bt_dev_dbg(hdev, "status 0x%2.2x", ev->status);
hci_dev_lock(hdev);