Bluetooth: controller: split: Schedule auxiliary after primary PDU

Fix to avoid a crash due to missing aux_ptr in current
primary PDU constructed by LE Set Extended Advertising
Parameter Set, while aux_ptr was populated by LE Set
Extended Advertising Data Set in the latest double buffered
PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2020-04-21 15:08:14 +05:30 committed by Carles Cufí
commit 29f26bac24
2 changed files with 11 additions and 0 deletions

View file

@ -149,6 +149,9 @@ static int prepare_cb(struct lll_prepare_param *prepare_param)
if (h->adi) {
ptr += sizeof(struct ext_adv_adi);
}
LL_ASSERT((pri->type == PDU_ADV_TYPE_EXT_IND) && h->aux_ptr);
aux = (void *)ptr;
#if !defined(BT_CTLR_ADV_EXT_PBACK)

View file

@ -1010,11 +1010,19 @@ uint8_t ll_adv_enable(uint8_t enable)
aux = (void *)HDR_LLL2EVT(lll_aux);
ull_hdr_init(&aux->ull);
/* Keep aux interval equal or higher than primary PDU
* interval.
*/
aux->interval =
adv->interval +
(HAL_TICKER_TICKS_TO_US(ULL_ADV_RANDOM_DELAY) /
625U);
/* schedule after primary channel PDUs */
ticks_anchor += ticks_slot;
ticks_anchor += HAL_TICKER_US_TO_TICKS(EVENT_MAFS_US);
ret = ull_adv_aux_start(aux, ticks_anchor, &ret_cb);
aux_is_started = 1U;