Bluetooth: controller: Handle AD data set race condition
Detect and handle AD data set race condition between thread and ISR context. Fixes #27637. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
530c090cba
commit
13bbfc8172
14 changed files with 55 additions and 32 deletions
|
@ -7,13 +7,16 @@
|
|||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <zephyr/types.h>
|
||||
#include <zephyr.h>
|
||||
#include <soc.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/controller.h>
|
||||
|
||||
#include "util/util.h"
|
||||
#include "util/memq.h"
|
||||
|
||||
#include "hal/cpu.h"
|
||||
|
||||
#include "pdu.h"
|
||||
#include "ll.h"
|
||||
#include "lll.h"
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/types.h>
|
||||
#include <toolchain.h>
|
||||
#include <zephyr.h>
|
||||
#include <soc.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/hci_vs.h>
|
||||
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/ccm.h"
|
||||
#include "hal/radio.h"
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <zephyr/types.h>
|
||||
#include <zephyr.h>
|
||||
#include <soc.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
#include <toolchain.h>
|
||||
#include <bluetooth/hci.h>
|
||||
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/ccm.h"
|
||||
#include "hal/radio.h"
|
||||
#include "hal/ticker.h"
|
||||
|
@ -41,7 +41,6 @@
|
|||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_lll_adv
|
||||
#include "common/log.h"
|
||||
#include <soc.h>
|
||||
#include "hal/debug.h"
|
||||
|
||||
static int init_reset(void);
|
||||
|
|
|
@ -108,15 +108,27 @@ void lll_adv_prepare(void *param);
|
|||
static inline struct pdu_adv *lll_adv_pdu_alloc(struct lll_adv_pdu *pdu,
|
||||
uint8_t *idx)
|
||||
{
|
||||
uint8_t last;
|
||||
uint8_t first, last;
|
||||
|
||||
if (pdu->first == pdu->last) {
|
||||
last = pdu->last + 1;
|
||||
first = pdu->first;
|
||||
last = pdu->last;
|
||||
if (first == last) {
|
||||
last++;
|
||||
if (last == DOUBLE_BUFFER_SIZE) {
|
||||
last = 0U;
|
||||
}
|
||||
} else {
|
||||
last = pdu->last;
|
||||
uint8_t first_latest;
|
||||
|
||||
pdu->last = first;
|
||||
cpu_dsb();
|
||||
first_latest = pdu->first;
|
||||
if (first_latest != first) {
|
||||
last++;
|
||||
if (last == DOUBLE_BUFFER_SIZE) {
|
||||
last = 0U;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*idx = last;
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <toolchain.h>
|
||||
#include <zephyr/types.h>
|
||||
#include <zephyr.h>
|
||||
#include <soc.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/ccm.h"
|
||||
#include "hal/radio.h"
|
||||
#include "hal/ticker.h"
|
||||
|
@ -32,7 +33,6 @@
|
|||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_lll_adv_aux
|
||||
#include "common/log.h"
|
||||
#include <soc.h>
|
||||
#include "hal/debug.h"
|
||||
|
||||
static int init_reset(void);
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <toolchain.h>
|
||||
#include <zephyr/types.h>
|
||||
#include <sys/util.h>
|
||||
#include <zephyr.h>
|
||||
#include <soc.h>
|
||||
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/ccm.h"
|
||||
#include "hal/radio.h"
|
||||
#include "hal/ticker.h"
|
||||
|
@ -33,7 +33,6 @@
|
|||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_lll_adv_sync
|
||||
#include "common/log.h"
|
||||
#include <soc.h>
|
||||
#include "hal/debug.h"
|
||||
|
||||
static int init_reset(void);
|
||||
|
|
|
@ -8,13 +8,15 @@
|
|||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <zephyr/types.h>
|
||||
#include <zephyr.h>
|
||||
#include <soc.h>
|
||||
#include <device.h>
|
||||
#include <drivers/entropy.h>
|
||||
#include <bluetooth/hci.h>
|
||||
|
||||
#include "hal/cntr.h"
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/ccm.h"
|
||||
#include "hal/cntr.h"
|
||||
#include "hal/ticker.h"
|
||||
|
||||
#include "util/util.h"
|
||||
|
|
|
@ -8,8 +8,10 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <soc.h>
|
||||
#include <bluetooth/hci.h>
|
||||
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/ccm.h"
|
||||
#include "hal/radio.h"
|
||||
#include "hal/ticker.h"
|
||||
|
@ -47,7 +49,6 @@
|
|||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_ull_adv
|
||||
#include "common/log.h"
|
||||
#include <soc.h>
|
||||
#include "hal/debug.h"
|
||||
|
||||
inline struct ll_adv_set *ull_adv_set_get(uint8_t handle);
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/types.h>
|
||||
#include <sys/byteorder.h>
|
||||
#include <zephyr.h>
|
||||
#include <soc.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/ticker.h"
|
||||
|
||||
#include "util/util.h"
|
||||
|
@ -33,7 +35,6 @@
|
|||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_ull_adv_aux
|
||||
#include "common/log.h"
|
||||
#include <soc.h>
|
||||
#include "hal/debug.h"
|
||||
|
||||
static int init_reset(void);
|
||||
|
|
|
@ -4,10 +4,12 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/types.h>
|
||||
#include <sys/byteorder.h>
|
||||
#include <zephyr.h>
|
||||
#include <soc.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/ticker.h"
|
||||
|
||||
#include "util/util.h"
|
||||
|
@ -34,7 +36,6 @@
|
|||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_ull_adv_sync
|
||||
#include "common/log.h"
|
||||
#include <soc.h>
|
||||
#include "hal/debug.h"
|
||||
|
||||
static int init_reset(void);
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <sys/byteorder.h>
|
||||
#include <soc.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/ccm.h"
|
||||
|
||||
#include "util/util.h"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <soc.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
|
@ -12,6 +13,7 @@
|
|||
#include "util/memq.h"
|
||||
#include "util/mayfly.h"
|
||||
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/ccm.h"
|
||||
#include "hal/radio.h"
|
||||
#include "hal/ticker.h"
|
||||
|
@ -47,7 +49,6 @@
|
|||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_ull_master
|
||||
#include "common/log.h"
|
||||
#include <soc.h>
|
||||
#include "hal/debug.h"
|
||||
|
||||
static void ticker_op_stop_scan_cb(uint32_t status, void *params);
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <soc.h>
|
||||
#include <bluetooth/hci.h>
|
||||
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/ccm.h"
|
||||
#include "hal/radio.h"
|
||||
#include "hal/ticker.h"
|
||||
|
@ -41,7 +43,6 @@
|
|||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_ull_scan
|
||||
#include "common/log.h"
|
||||
#include <soc.h>
|
||||
#include "hal/debug.h"
|
||||
|
||||
static int init_reset(void);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <soc.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
|
@ -12,6 +13,7 @@
|
|||
#include "util/memq.h"
|
||||
#include "util/mayfly.h"
|
||||
|
||||
#include "hal/cpu.h"
|
||||
#include "hal/ccm.h"
|
||||
#include "hal/radio.h"
|
||||
#include "hal/ticker.h"
|
||||
|
@ -41,7 +43,6 @@
|
|||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
|
||||
#define LOG_MODULE_NAME bt_ctlr_ull_slave
|
||||
#include "common/log.h"
|
||||
#include <soc.h>
|
||||
#include "hal/debug.h"
|
||||
|
||||
static void ticker_op_stop_adv_cb(uint32_t status, void *param);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue