You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2017/04/11 00:55:12 UTC

[06/11] incubator-mynewt-core git commit: nimble/l2cap: Fix locking on LE CoC connect

nimble/l2cap: Fix locking on LE CoC connect

Make sure to do hs unlock before ble_l2cap_sig_tx() as this function
does it's own locking.
Found during writing unit test for LE CoC


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/e6d3b0e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/e6d3b0e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/e6d3b0e6

Branch: refs/heads/master
Commit: e6d3b0e6c2ed8351e0931ec4858be2651e21bfd9
Parents: f902592
Author: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Authored: Wed Mar 15 12:28:21 2017 +0100
Committer: \u0141ukasz Rymanowski <lu...@codecoup.pl>
Committed: Thu Apr 6 10:04:03 2017 +0200

----------------------------------------------------------------------
 net/nimble/host/src/ble_l2cap_sig.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/e6d3b0e6/net/nimble/host/src/ble_l2cap_sig.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_l2cap_sig.c b/net/nimble/host/src/ble_l2cap_sig.c
index c9c1886..09ff8e0 100644
--- a/net/nimble/host/src/ble_l2cap_sig.c
+++ b/net/nimble/host/src/ble_l2cap_sig.c
@@ -836,13 +836,14 @@ ble_l2cap_sig_coc_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
     req->mps = htole16(chan->my_mtu);
     req->credits = htole16(chan->coc_rx.credits);
 
+    ble_hs_unlock();
+
     rc = ble_l2cap_sig_tx(proc->conn_handle, txom);
     if (rc != 0) {
         ble_l2cap_chan_free(chan);
     }
 
     ble_l2cap_sig_process_status(proc, rc);
-    ble_hs_unlock();
 
     return rc;
 }