From 50b28c010de851b59261c12cf4167865e470d6fa Mon Sep 17 00:00:00 2001 From: Joakim Andersson Date: Wed, 7 Aug 2019 16:42:02 +0200 Subject: [PATCH] Bluetooth: controller: Fix assert in RPA timeout for advertiser Fix assert in the RPA timeout when no resolving entry exists in the resolving list, and the advertiser was requested to use a local IRK to generate it's own address. Signed-off-by: Joakim Andersson --- subsys/bluetooth/controller/ll_sw/ll_filter.c | 7 +++++-- subsys/bluetooth/controller/ll_sw/ull_filter.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ll_filter.c b/subsys/bluetooth/controller/ll_sw/ll_filter.c index 307021d8959..bb59102f665 100644 --- a/subsys/bluetooth/controller/ll_sw/ll_filter.c +++ b/subsys/bluetooth/controller/ll_sw/ll_filter.c @@ -567,6 +567,11 @@ static void rpa_adv_refresh(void) return; } + idx = ll_rl_find(ll_adv->id_addr_type, ll_adv->id_addr, NULL); + if (idx >= ARRAY_SIZE(rl)) { + return; + } + radio_adv_data = radio_adv_data_get(); prev = (struct pdu_adv *)&radio_adv_data->data[radio_adv_data->last][0]; /* use the last index in double buffer, */ @@ -590,8 +595,6 @@ static void rpa_adv_refresh(void) pdu->chan_sel = 0U; } - idx = ll_rl_find(ll_adv->id_addr_type, ll_adv->id_addr, NULL); - LL_ASSERT(idx < ARRAY_SIZE(rl)); ll_rl_pdu_adv_update(idx, pdu); memcpy(&pdu->adv_ind.data[0], &prev->adv_ind.data[0], diff --git a/subsys/bluetooth/controller/ll_sw/ull_filter.c b/subsys/bluetooth/controller/ll_sw/ull_filter.c index 62e2bd1e1b5..7238c973ec1 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_filter.c +++ b/subsys/bluetooth/controller/ll_sw/ull_filter.c @@ -872,6 +872,11 @@ static void rpa_adv_refresh(struct ll_adv_set *adv) return; } + idx = ull_filter_rl_find(adv->id_addr_type, adv->id_addr, NULL); + if (idx >= ARRAY_SIZE(rl)) { + return; + } + prev = lll_adv_data_peek(&adv->lll); pdu = lll_adv_data_alloc(&adv->lll, &idx); pdu->type = prev->type; @@ -883,8 +888,6 @@ static void rpa_adv_refresh(struct ll_adv_set *adv) pdu->chan_sel = 0; } - idx = ull_filter_rl_find(adv->id_addr_type, adv->id_addr, NULL); - LL_ASSERT(idx < ARRAY_SIZE(rl)); ull_filter_adv_pdu_update(adv, idx, pdu); memcpy(&pdu->adv_ind.data[0], &prev->adv_ind.data[0],