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 2019/02/25 11:42:24 UTC

[mynewt-nimble] branch master updated: nimble/host: Fix ble_sm_tx called without a lock

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


The following commit(s) were added to refs/heads/master by this push:
     new ff5d9a6  nimble/host: Fix ble_sm_tx called without a lock
ff5d9a6 is described below

commit ff5d9a6211f307b055fd018f705fcf08023fee86
Author: Simon Ratner <si...@probablyprime.net>
AuthorDate: Sun Feb 24 23:16:49 2019 -0800

    nimble/host: Fix ble_sm_tx called without a lock
---
 nimble/host/src/ble_sm.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/nimble/host/src/ble_sm.c b/nimble/host/src/ble_sm.c
index 1744832..1b8bbca 100644
--- a/nimble/host/src/ble_sm.c
+++ b/nimble/host/src/ble_sm.c
@@ -2727,6 +2727,7 @@ ble_sm_rx(struct ble_l2cap_chan *chan)
     struct ble_sm_pair_fail *cmd;
     struct os_mbuf *txom;
     uint16_t handle;
+    int rc;
 
     handle = ble_l2cap_get_conn_handle(chan);
     if (!handle) {
@@ -2740,7 +2741,11 @@ ble_sm_rx(struct ble_l2cap_chan *chan)
 
     cmd->reason = BLE_SM_ERR_PAIR_NOT_SUPP;
 
-    return ble_sm_tx(handle, txom);
+    ble_hs_lock();
+    rc = ble_sm_tx(handle, txom);
+    ble_hs_unlock();
+
+    return rc;
 }
 #endif