Skip to content

Commit 3afee21

Browse files
eknoesVudentz
authored andcommitted
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 <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent c07ba87 commit 3afee21

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

net/bluetooth/hci_event.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4661,6 +4661,19 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, void *data,
46614661
struct hci_ev_sync_conn_complete *ev = data;
46624662
struct hci_conn *conn;
46634663

4664+
switch (ev->link_type) {
4665+
case SCO_LINK:
4666+
case ESCO_LINK:
4667+
break;
4668+
default:
4669+
/* As per Core 5.3 Vol 4 Part E 7.7.35 (p.2219), Link_Type
4670+
* for HCI_Synchronous_Connection_Complete is limited to
4671+
* either SCO or eSCO
4672+
*/
4673+
bt_dev_err(hdev, "Ignoring connect complete event for invalid link type");
4674+
return;
4675+
}
4676+
46644677
bt_dev_dbg(hdev, "status 0x%2.2x", ev->status);
46654678

46664679
hci_dev_lock(hdev);

0 commit comments

Comments
 (0)