From 6d1e324447d119e817f20d9efa74f3b30b8cad0f Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 6 Jan 2021 13:34:30 +0530 Subject: [PATCH] Bluetooth: controller: Fix periodic sync cancel for Coded PHY Fix cancel of Periodic Synchronization on Coded PHY. Reset the association of periodic sync instance after validation of command disallowed. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ull_sync.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_sync.c b/subsys/bluetooth/controller/ll_sw/ull_sync.c index 9023cfa812ead..71993520497d7 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_sync.c +++ b/subsys/bluetooth/controller/ll_sw/ull_sync.c @@ -197,19 +197,19 @@ uint8_t ll_sync_create_cancel(void **rx) } } - sync = scan->per_scan.sync; - scan->per_scan.sync = NULL; - if (IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED)) { - scan_coded->per_scan.sync = NULL; - } - /* Check for race condition where in sync is established when sync * context was set to NULL. */ + sync = scan->per_scan.sync; if (!sync || sync->timeout_reload) { return BT_HCI_ERR_CMD_DISALLOWED; } + scan->per_scan.sync = NULL; + if (IS_ENABLED(CONFIG_BT_CTLR_PHY_CODED)) { + scan_coded->per_scan.sync = NULL; + } + node_rx = (void *)scan->per_scan.node_rx_estab; link_sync_estab = node_rx->hdr.link; link_sync_lost = sync->node_rx_lost.hdr.link;