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

[mynewt-nimble] branch master updated (11f16a0 -> 5622954)

This is an automated email from the ASF dual-hosted git repository.

rymek pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git.


    from 11f16a0  nimble/host: Fix check for valid static random address
     new f14bc9b  nimble/l2cap: Fix possible memory leak
     new 7bc2227  nimble/l2cap: Fix hs locking on reconfigure request
     new 5622954  nimble/l2cap: Move proc initialization Without that identifier was incorrectly set to 0

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 nimble/host/src/ble_l2cap_sig.c | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)


[mynewt-nimble] 02/03: nimble/l2cap: Fix hs locking on reconfigure request

Posted by ry...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 7bc2227df870be557552c723df0b1ec1c0752809
Author: Łukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Wed Mar 11 20:48:36 2020 +0100

    nimble/l2cap: Fix hs locking on reconfigure request
---
 nimble/host/src/ble_l2cap_sig.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/nimble/host/src/ble_l2cap_sig.c b/nimble/host/src/ble_l2cap_sig.c
index 9252ce5..165af91 100644
--- a/nimble/host/src/ble_l2cap_sig.c
+++ b/nimble/host/src/ble_l2cap_sig.c
@@ -750,14 +750,14 @@ ble_l2cap_sig_credit_base_reconfig_req_rx(uint16_t conn_handle,
 
     if (hdr->length <= sizeof(*req)) {
         rsp->result = htole16(BLE_L2CAP_ERR_RECONFIG_UNACCAPTED_PARAM);
-        goto done;
+        goto failed;
     }
 
     req = (struct ble_l2cap_sig_credit_base_reconfig_req *)(*om)->om_data;
 
     if ((req->mps < BLE_L2CAP_ECOC_MIN_MTU) || (req->mtu < BLE_L2CAP_ECOC_MIN_MTU)) {
         rsp->result = htole16(BLE_L2CAP_ERR_RECONFIG_UNACCAPTED_PARAM);
-        goto done;
+        goto failed;
     }
 
     /* Assume request will succeed. If not, result will be updated */
@@ -766,41 +766,43 @@ ble_l2cap_sig_credit_base_reconfig_req_rx(uint16_t conn_handle,
     cid_cnt = (hdr->length - sizeof(*req)) / sizeof(uint16_t);
     if (cid_cnt > BLE_L2CAP_MAX_COC_CONN_REQ) {
         rsp->result = htole16(BLE_L2CAP_ERR_RECONFIG_UNACCAPTED_PARAM);
-        goto done;
+        goto failed;
     }
 
     for (i = 0; i < cid_cnt; i++) {
         chan[i] = ble_hs_conn_chan_find_by_dcid(conn, req->dcids[i]);
         if (!chan[i]) {
              rsp->result = htole16(BLE_L2CAP_ERR_RECONFIG_INVALID_DCID);
-             ble_hs_unlock();
-             goto done;
+             goto failed;
         }
 
         if (chan[i]->peer_coc_mps > req->mps) {
             reduction_mps++;
             if (reduction_mps > 1) {
                 rsp->result = htole16(BLE_L2CAP_ERR_RECONFIG_REDUCTION_MPS_NOT_ALLOWED);
-                ble_hs_unlock();
-                goto done;
+                goto failed;
             }
         }
 
         if (chan[i]->coc_tx.mtu > req->mtu) {
             rsp->result = htole16(BLE_L2CAP_ERR_RECONFIG_REDUCTION_MTU_NOT_ALLOWED);
-            ble_hs_unlock();
-            goto done;
+            goto failed;
         }
     }
 
+    ble_hs_unlock();
+
     for (i = 0; i < cid_cnt; i++) {
         chan[i]->coc_tx.mtu = req->mtu;
         chan[i]->peer_coc_mps = req->mps;
         ble_l2cap_event_coc_reconfigured(conn_handle, 0, chan[i], true);
     }
 
+    ble_l2cap_sig_tx(conn_handle, txom);
+    return 0;
+
+failed:
     ble_hs_unlock();
-done:
     ble_l2cap_sig_tx(conn_handle, txom);
     return 0;
 }


[mynewt-nimble] 03/03: nimble/l2cap: Move proc initialization Without that identifier was incorrectly set to 0

Posted by ry...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 56229549cf0cbd0819307936aa15075dc0abac64
Author: Łukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Wed Mar 11 20:49:25 2020 +0100

    nimble/l2cap: Move proc initialization
    Without that identifier was incorrectly set to 0
---
 nimble/host/src/ble_l2cap_sig.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/nimble/host/src/ble_l2cap_sig.c b/nimble/host/src/ble_l2cap_sig.c
index 165af91..bb4d8a5 100644
--- a/nimble/host/src/ble_l2cap_sig.c
+++ b/nimble/host/src/ble_l2cap_sig.c
@@ -1368,6 +1368,10 @@ ble_l2cap_sig_ecoc_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
         return BLE_HS_ENOMEM;
     }
 
+    proc->op = BLE_L2CAP_SIG_PROC_OP_CONNECT;
+    proc->id = ble_l2cap_sig_next_id();
+    proc->conn_handle = conn_handle;
+
     req = ble_l2cap_sig_cmd_get(BLE_L2CAP_SIG_OP_CREDIT_CONNECT_REQ, proc->id,
                                 sizeof(*req) + num * sizeof(uint16_t), &txom);
     if (!req) {
@@ -1396,10 +1400,6 @@ ble_l2cap_sig_ecoc_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
     }
     proc->connect.chan_cnt = num;
 
-    proc->op = BLE_L2CAP_SIG_PROC_OP_CONNECT;
-    proc->id = ble_l2cap_sig_next_id();
-    proc->conn_handle = conn_handle;
-
     req->psm = htole16(psm);
     req->mtu = htole16(chan->coc_rx.mtu);
     req->mps = htole16(chan->my_mtu);


[mynewt-nimble] 01/03: nimble/l2cap: Fix possible memory leak

Posted by ry...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit f14bc9b6a045de1d023157a11526cd17ee9bf5b7
Author: Łukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Wed Feb 26 15:22:08 2020 +0100

    nimble/l2cap: Fix possible memory leak
---
 nimble/host/src/ble_l2cap_sig.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/nimble/host/src/ble_l2cap_sig.c b/nimble/host/src/ble_l2cap_sig.c
index 65c826c..9252ce5 100644
--- a/nimble/host/src/ble_l2cap_sig.c
+++ b/nimble/host/src/ble_l2cap_sig.c
@@ -1306,7 +1306,9 @@ ble_l2cap_sig_coc_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
     if (!req) {
         ble_l2cap_chan_free(conn, chan);
         ble_hs_unlock();
-        return BLE_HS_ENOMEM;
+        rc = BLE_HS_ENOMEM;
+        /* Goto done to clear proc */
+        goto done;
     }
 
     req->psm = htole16(psm);
@@ -1325,6 +1327,7 @@ ble_l2cap_sig_coc_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
         ble_hs_unlock();
     }
 
+done:
     ble_l2cap_sig_process_status(proc, rc);
 
     return rc;