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 c1d52a2cc nimble/ll: Fix infinite loop on RPA rotation
c1d52a2cc is described below

commit c1d52a2cc813dc0b4757cf83fba9488157aa819d
Author: Szymon Janc <[email protected]>
AuthorDate: Mon Feb 23 11:59:31 2026 +0100

    nimble/ll: Fix infinite loop on RPA rotation
    
    ble_ll_resolv_gen_priv_addr must not be called with IRQs disabled
    since it may require additional random data and thus requires HW
    random source. Otherwise it may end up in infinite poll-loop waiting
    for more random data.
---
 nimble/controller/src/ble_ll_resolv.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/nimble/controller/src/ble_ll_resolv.c 
b/nimble/controller/src/ble_ll_resolv.c
index 3566876e0..f6ededc63 100644
--- a/nimble/controller/src/ble_ll_resolv.c
+++ b/nimble/controller/src/ble_ll_resolv.c
@@ -138,25 +138,23 @@ static void
 ble_ll_resolv_rpa_timer_cb(struct ble_npl_event *ev)
 {
     int i;
-    os_sr_t sr;
+    uint8_t rpa[6];
     struct ble_ll_resolv_entry *rl;
 #if MYNEWT_VAL(BLE_LL_HCI_VS_LOCAL_IRK)
     struct local_irk_data *irk_data;
-    uint8_t rpa[6];
+    os_sr_t sr;
 #endif
 
     rl = &g_ble_ll_resolv_list[0];
     for (i = 0; i < g_ble_ll_resolv_data.rl_cnt; ++i) {
         if (rl->rl_has_local) {
-            OS_ENTER_CRITICAL(sr);
-            ble_ll_resolv_gen_priv_addr(rl, 1);
-            OS_EXIT_CRITICAL(sr);
+            generate_rpa(rl->rl_local_irk, rpa);
+            ble_ll_resolv_set_local_rpa(i, rpa);
         }
 
         if (rl->rl_has_peer) {
-            OS_ENTER_CRITICAL(sr);
-            ble_ll_resolv_gen_priv_addr(rl, 0);
-            OS_EXIT_CRITICAL(sr);
+            generate_rpa(rl->rl_peer_irk, rpa);
+            ble_ll_resolv_set_peer_rpa(i, rpa);
         }
         ++rl;
     }

Reply via email to