You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2022/02/24 14:33:16 UTC
[mynewt-nimble] 06/10: nimble/ll: Fix race on create connection
This is an automated email from the ASF dual-hosted git repository.
andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit fa3fd20b79d0151878d384a37369eb994d8638a2
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Feb 23 17:01:42 2022 +0100
nimble/ll: Fix race on create connection
If AUX_CONNECT_RSP is invalid we should immediately remove connection
from scheduler, then we can do other stuff. In other case, we may be
a bit too late and scheduler will fire already scheduled connection
event for a connection that is not created.
---
nimble/controller/src/ble_ll_scan_aux.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/nimble/controller/src/ble_ll_scan_aux.c b/nimble/controller/src/ble_ll_scan_aux.c
index 933c3f7..c637be7 100644
--- a/nimble/controller/src/ble_ll_scan_aux.c
+++ b/nimble/controller/src/ble_ll_scan_aux.c
@@ -1567,8 +1567,9 @@ ble_ll_scan_aux_rx_pkt_in_for_initiator(struct os_mbuf *rxpdu,
aux = rxinfo->user_data;
if (rxinfo->flags & BLE_MBUF_HDR_F_IGNORED) {
+ ble_ll_scan_aux_free(aux);
ble_ll_scan_chk_resume();
- goto done;
+ return;
}
if (!(rxinfo->flags & BLE_MBUF_HDR_F_CONNECT_RSP_RXD)) {
@@ -1582,19 +1583,14 @@ ble_ll_scan_aux_rx_pkt_in_for_initiator(struct os_mbuf *rxpdu,
if (ble_ll_scan_aux_check_connect_rsp(rxpdu->om_data,
ble_ll_scan_get_pdu_data(),
&addrd) < 0) {
+ ble_ll_conn_send_connect_req_cancel();
+ ble_ll_scan_aux_free(aux);
ble_ll_scan_chk_resume();
- goto done;
+ return;
}
- aux->flags &= ~BLE_LL_SCAN_AUX_F_W4_CONNECT_RSP;
-
ble_ll_scan_sm_stop(0);
ble_ll_conn_created_on_aux(rxpdu, &addrd, aux->targeta);
-
-done:
- if (aux->flags & BLE_LL_SCAN_AUX_F_W4_CONNECT_RSP) {
- ble_ll_conn_send_connect_req_cancel();
- }
ble_ll_scan_aux_free(aux);
}
#endif