From a6e8cf437401e5ae15b0908b5e8fc61d9fc452a3 Mon Sep 17 00:00:00 2001 From: Marek Pieta Date: Wed, 15 Jul 2020 00:56:57 -0700 Subject: [PATCH] bluetooth: gatt: Fix storing subscriptions Change fixes storing subscriptions in settings. CCC write can interrupt the ccc_delayed_store. Without the change, new CCC was not stored in non-volatile memory and the work that stored CCC was not resubmitted. That resulted in lost subscription after reboot. Fixes: #26862 Signed-off-by: Marek Pieta --- subsys/bluetooth/host/gatt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index b523ee2f985..52d3db201f5 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -992,9 +992,9 @@ static void ccc_delayed_store(struct k_work *work) } if (bt_addr_le_is_bonded(conn->id, &conn->le.dst)) { + ccc_store->conn_list[i] = NULL; bt_gatt_store_ccc(conn->id, &conn->le.dst); bt_conn_unref(conn); - ccc_store->conn_list[i] = NULL; } } }