Skip to content

Commit 06e18c6

Browse files
Vudentzcarlescufi
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 168389c commit 06e18c6

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
@@ -1140,6 +1140,8 @@ static void le_ecred_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
11401140
goto response;
11411141
}
11421142

1143+
memset(dcid, 0, sizeof(dcid));
1144+
11431145
while (buf->len >= sizeof(scid)) {
11441146
scid = net_buf_pull_le16(buf);
11451147

@@ -1151,20 +1153,16 @@ static void le_ecred_conn_req(struct bt_l2cap *l2cap, uint8_t ident,
11511153
dcid[i++] = sys_cpu_to_le16(ch->rx.cid);
11521154
continue;
11531155
/* Some connections refused – invalid Source CID */
1154-
case BT_L2CAP_LE_ERR_INVALID_SCID:
11551156
/* Some connections refused – Source CID already allocated */
1156-
case BT_L2CAP_LE_ERR_SCID_IN_USE:
1157+
/* Some connections refused – not enough resources
1158+
* available.
1159+
*/
1160+
default:
11571161
/* If a Destination CID is 0x0000, the channel was not
11581162
* established.
11591163
*/
11601164
dcid[i++] = 0x0000;
11611165
continue;
1162-
/* Some connections refused – not enough resources
1163-
* available.
1164-
*/
1165-
case BT_L2CAP_LE_ERR_NO_RESOURCES:
1166-
default:
1167-
goto response;
11681166
}
11691167
}
11701168

0 commit comments

Comments
 (0)