Skip to content

Commit a1d73ac

Browse files
joerchanjhedberg
authored andcommitted
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 363c4d1 commit a1d73ac

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
@@ -1206,6 +1206,10 @@ void bt_conn_recv(struct bt_conn *conn, struct net_buf *buf, u8_t flags)
12061206

12071207
break;
12081208
default:
1209+
/* BT_ACL_START_NO_FLUSH and BT_ACL_COMPLETE are not allowed on
1210+
* LE-U from Controller to Host.
1211+
* Only BT_ACL_POINT_TO_POINT is supported.
1212+
*/
12091213
BT_ERR("Unexpected ACL flags (0x%02x)", flags);
12101214
bt_conn_reset_rx_state(conn);
12111215
net_buf_unref(buf);

0 commit comments

Comments
 (0)