You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2017/03/30 03:21:13 UTC

[2/2] incubator-mynewt-core git commit: MYNEWT-697: Controller can leak connection state machines

MYNEWT-697: Controller can leak connection state machines

Fixed bug where it was possible that a controller could allocate
a connection state machine and never make it active or free it.
If this happens, it is possible that the controller would not
be able to create a new connection. This particular bug would
only occur if the device was a central and would occur during
the le create connection command.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/bf901055
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/bf901055
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/bf901055

Branch: refs/heads/develop
Commit: bf901055b8e6b24072f2ae1dd3b2ccf0f0a4fac3
Parents: cb97248
Author: William San Filippo <wi...@runtime.io>
Authored: Wed Mar 29 20:15:55 2017 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Wed Mar 29 20:21:07 2017 -0700

----------------------------------------------------------------------
 net/nimble/controller/src/ble_ll_conn_hci.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/bf901055/net/nimble/controller/src/ble_ll_conn_hci.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_conn_hci.c b/net/nimble/controller/src/ble_ll_conn_hci.c
index 3ed9147..9b25002 100644
--- a/net/nimble/controller/src/ble_ll_conn_hci.c
+++ b/net/nimble/controller/src/ble_ll_conn_hci.c
@@ -481,17 +481,17 @@ ble_ll_conn_create(uint8_t *cmdbuf)
         return BLE_ERR_INV_HCI_CMD_PARMS;
     }
 
+    /* Make sure we can allocate an event to send the connection complete */
+    if (ble_ll_init_alloc_conn_comp_ev()) {
+        return BLE_ERR_MEM_CAPACITY;
+    }
+
     /* Make sure we can accept a connection! */
     connsm = ble_ll_conn_sm_get();
     if (connsm == NULL) {
         return BLE_ERR_CONN_LIMIT;
     }
 
-    /* Make sure we can allocate an event to send the connection complete */
-    if (ble_ll_init_alloc_conn_comp_ev()) {
-        return BLE_ERR_MEM_CAPACITY;
-    }
-
     /* Initialize state machine in master role and start state machine */
     ble_ll_conn_master_init(connsm, hcc);
     ble_ll_conn_sm_new(connsm);