/* See if we have a link control block for the remote device */
p_lcb = l2cu_find_lcb_by_bd_addr(ci.bd_addr, BT_TRANSPORT_BR_EDR);
- /* If we don't have one, this is an error */
- if (!p_lcb) {
- L2CAP_TRACE_WARNING("L2CAP got conn_comp for unknown BD_ADDR");
- return (false);
+ /* If we don't have one, allocate one */
+ if (p_lcb == nullptr) {
+ L2CAP_TRACE_WARNING("No available link control block, try allocate one");
+ p_lcb = l2cu_allocate_lcb(ci.bd_addr, false, BT_TRANSPORT_BR_EDR);
+ if (p_lcb == nullptr) {
+ L2CAP_TRACE_WARNING("%s: Failed to allocate an LCB", __func__);
+ return (false);
+ }
+ p_lcb->link_state = LST_CONNECTING;
}
if (p_lcb->link_state != LST_CONNECTING) {