Skip to content

Commit 6bef109

Browse files
committed
Bluetooth: HCI: Handle invalid ACL flags.
Handle invalid ACL flags in HCI transport. Only Point to Point is supported over HCI in both directions. Fix flushable start HCI ACL packets not allowed on LE-U connections from Host to controller. Signed-off-by: Joakim Andersson <[email protected]>
1 parent a3afac2 commit 6bef109

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

subsys/bluetooth/controller/hci/hci.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,11 +2336,24 @@ int hci_acl_handle(struct net_buf *buf, struct net_buf **evt)
23362336

23372337
pdu_data = (void *)node_tx->pdu;
23382338

2339-
if (flags == BT_ACL_START_NO_FLUSH || flags == BT_ACL_START) {
2339+
if (bt_acl_flags_bc(flags) != BT_ACL_POINT_TO_POINT) {
2340+
return -EINVAL;
2341+
}
2342+
2343+
switch (bt_acl_flags_pb(flags)) {
2344+
case BT_ACL_START_NO_FLUSH:
23402345
pdu_data->ll_id = PDU_DATA_LLID_DATA_START;
2341-
} else {
2346+
break;
2347+
case BT_ACL_CONT:
23422348
pdu_data->ll_id = PDU_DATA_LLID_DATA_CONTINUE;
2349+
break;
2350+
default:
2351+
/* BT_ACL_START and BT_ACL_COMPLETE not allowed on LE-U
2352+
* from Host to Controller
2353+
*/
2354+
return -EINVAL;
23432355
}
2356+
23442357
pdu_data->len = len;
23452358
memcpy(&pdu_data->lldata[0], buf->data, len);
23462359

subsys/bluetooth/host/conn.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,10 @@ void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, u8_t flags)
11681168

11691169
break;
11701170
default:
1171+
/* BT_ACL_START_NO_FLUSH and BT_ACL_COMPLETE are not allowed on
1172+
* LE-U from Controller to Host.
1173+
* Only BT_ACL_POINT_TO_POINT is supported.
1174+
*/
11711175
BT_ERR("Unexpected ACL flags (0x%02x)", flags);
11721176
bt_conn_reset_rx_state(conn);
11731177
net_buf_unref(buf);

0 commit comments

Comments
 (0)