From ae9bf5e440d297ca12bcf1e7134f6ec3e02f207c Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 19 Feb 2020 21:17:47 +0530 Subject: [PATCH] Bluetooth: controller: split: Fix radio in use during flash op Fix a race condition in radio abort requested by flash driver. It is possible that during abort function execution, PPI setup to start radio fires. Hence, check explicitly in cleanup function for radio being in use and disable it. Fixes #22945. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c | 4 ++++ subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c | 4 ++++ subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c index 12bf96ac2fd..dd42a406c19 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_adv.c @@ -574,6 +574,10 @@ static void isr_cleanup(void *param) int err; radio_isr_set(isr_race, param); + if (!radio_is_idle()) { + radio_disable(); + } + radio_tmr_stop(); err = lll_clk_off(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c index 53980ba9bab..df786f5c164 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_conn.c @@ -632,6 +632,10 @@ static void isr_cleanup(void *param) int err; radio_isr_set(isr_race, param); + if (!radio_is_idle()) { + radio_disable(); + } + radio_tmr_stop(); err = lll_clk_off(); diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c index e4544dc3bc9..91860e3b462 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_scan.c @@ -636,6 +636,10 @@ static void isr_cleanup(void *param) #endif /* !CONFIG_BT_CTLR_SCAN_INDICATION */ radio_isr_set(isr_race, param); + if (!radio_is_idle()) { + radio_disable(); + } + radio_tmr_stop(); err = lll_clk_off();