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

janc 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 d7950095 nimble/host: Fix not handling error on RL element removal
d7950095 is described below

commit d7950095b1a3e61001509895c9ff4a064f43e0c6
Author: ESPAbhinav <128136388+espabhi...@users.noreply.github.com>
AuthorDate: Tue Oct 10 12:03:25 2023 +0530

    nimble/host: Fix not handling error on RL element removal
    
    To remove the device from the RPA List ble_gap_unpair() API is used
    which sends a command to the controller. This command shall not be
    used when address resolution is enabled in the Controller and:
    
    Advertising (other than periodic advertising) is enabled, Scanning is 
enabled,
    or an HCI_LE_Create_Connection, HCI_LE_Extended_Create_Connection, or
    HCI_LE_Periodic_Advertising_Create_Sync command is pending.
    
    An error check is added for the API ble_hs_pvcy_remove_entry which is
    invoked by ble_gap_unpair().
---
 nimble/host/src/ble_gap.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c
index 7922c524..807796dd 100644
--- a/nimble/host/src/ble_gap.c
+++ b/nimble/host/src/ble_gap.c
@@ -6059,6 +6059,7 @@ int
 ble_gap_unpair(const ble_addr_t *peer_addr)
 {
 #if NIMBLE_BLE_SM
+    int rc;
     struct ble_hs_conn *conn;
 
     if (!ble_hs_is_enabled()) {
@@ -6078,8 +6079,11 @@ ble_gap_unpair(const ble_addr_t *peer_addr)
 
     ble_hs_unlock();
 
-    ble_hs_pvcy_remove_entry(peer_addr->type,
+    rc = ble_hs_pvcy_remove_entry(peer_addr->type,
                              peer_addr->val);
+    if (rc != 0) {
+        return rc;
+    }
 
     return ble_store_util_delete_peer(peer_addr);
 #else

Reply via email to