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 f06f9363 nimble/host: Fix matching responses to ATT procedures
f06f9363 is described below

commit f06f9363b7a8e65f882bb6a6d9c18291b373a689
Author: Andrzej Kaczmarek <[email protected]>
AuthorDate: Thu Aug 8 16:19:24 2024 +0200

    nimble/host: Fix matching responses to ATT procedures
    
    If we sent the same request to two different peers at exactly the same
    time, it was possible that responses could be matched with invalid
    procedures.
---
 nimble/host/src/ble_gattc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/nimble/host/src/ble_gattc.c b/nimble/host/src/ble_gattc.c
index 4507317c..45ee869c 100644
--- a/nimble/host/src/ble_gattc.c
+++ b/nimble/host/src/ble_gattc.c
@@ -961,10 +961,12 @@ ble_gattc_proc_matches_conn_rx_entry(struct 
ble_gattc_proc *proc, void *arg)
 
     criteria = arg;
 
-    if (criteria->conn_handle != BLE_HS_CONN_HANDLE_NONE &&
-        criteria->conn_handle != proc->conn_handle &&
-        criteria->cid != proc->cid) {
+    if ((criteria->conn_handle != BLE_HS_CONN_HANDLE_NONE) &&
+        (criteria->conn_handle != proc->conn_handle)) {
+        return 0;
+    }
 
+    if (criteria->cid != proc->cid) {
         return 0;
     }
 

Reply via email to