From 902e1030c59d7899be81b7643d22d86623e26538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arkadiusz=20Ba=C5=82ys?= Date: Fri, 13 Oct 2023 08:53:17 +0200 Subject: [PATCH] Clear endpoint bitmask before reporting the PartList attribute (#29673) When we set a low value to the minimum subscription interval for subscription for the PartList attribute of the Description cluster, and then remove a dynamic endpoint the related bitmask may change after reporting it to a controller. The controller receives the old number of endpoints and does not update it within the following subscriptions until the next change of the PartList attribute occurs. To resolve the issue the endpoint bitmask should be cleared before reporting the PartList attribute of the Descriptor cluster to avoid race conditions. --- src/app/util/attribute-storage.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index 824df9835646f1..ce37246c4b3d9f 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -943,6 +943,7 @@ bool emberAfEndpointEnableDisable(EndpointId endpoint, bool enable) else { shutdownEndpoint(&(emAfEndpoints[index])); + emAfEndpoints[index].bitmask.Clear(EmberAfEndpointOptions::isEnabled); } EndpointId parentEndpointId = emberAfParentEndpointFromIndex(index); @@ -963,11 +964,6 @@ bool emberAfEndpointEnableDisable(EndpointId endpoint, bool enable) app::Clusters::Descriptor::Attributes::PartsList::Id); } - if (!enable) - { - emAfEndpoints[index].bitmask.Clear(EmberAfEndpointOptions::isEnabled); - } - return true; }