Skip to content

Commit cf3b638

Browse files
Vudentznashif
authored andcommitted
Bluetooth: L2CAP: Fix not including all DCIDs
The order of Destination CIDs shall correspond the order of Source CIDs including its amount so errors that don't result in all connection being refused shall not break the order of CIDs. Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent de142e4 commit cf3b638

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

subsys/bluetooth/host/l2cap.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,8 @@ static void le_ecred_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
11361136
goto response;
11371137
}
11381138

1139+
memset(dcid, 0, sizeof(dcid));
1140+
11391141
while (buf->len >= sizeof(scid)) {
11401142
scid = net_buf_pull_le16(buf);
11411143

@@ -1147,20 +1149,16 @@ static void le_ecred_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
11471149
dcid[i++] = sys_cpu_to_le16(ch->rx.cid);
11481150
continue;
11491151
/* Some connections refused – invalid Source CID */
1150-
case BT_L2CAP_LE_ERR_INVALID_SCID:
11511152
/* Some connections refused – Source CID already allocated */
1152-
case BT_L2CAP_LE_ERR_SCID_IN_USE:
1153+
/* Some connections refused – not enough resources
1154+
* available.
1155+
*/
1156+
default:
11531157
/* If a Destination CID is 0x0000, the channel was not
11541158
* established.
11551159
*/
11561160
dcid[i++] = 0x0000;
11571161
continue;
1158-
/* Some connections refused – not enough resources
1159-
* available.
1160-
*/
1161-
case BT_L2CAP_LE_ERR_NO_RESOURCES:
1162-
default:
1163-
goto response;
11641162
}
11651163
}
11661164

0 commit comments

Comments
 (0)