Skip to content

Commit 5079ee0

Browse files
committed
[nrf fromtree] Bluetooth: Mesh: Model extensions walk stops before last
...model When reaching the last model in the circular extension linked list, the walker would abandon the walk before checking the last model. This makes us skip models when checking the subscription list, potentially causing incoming messages to be wrongfully ignored. (cherry picked from commit cd89f42) Signed-off-by: Trond Einar Snekvik <[email protected]>
1 parent b471b72 commit 5079ee0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

subsys/bluetooth/mesh/access.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,12 +821,12 @@ void bt_mesh_model_extensions_walk(struct bt_mesh_model *model,
821821
#else
822822
struct bt_mesh_model *it;
823823

824-
if (model->next == NULL) {
825-
(void)cb(model, user_data);
824+
if (cb(model, user_data) == BT_MESH_WALK_STOP || !model->next) {
826825
return;
827826
}
828827

829-
for (it = model; (it != NULL) && (it->next != model); it = it->next) {
828+
/* List is circular. Step through all models until we reach the start: */
829+
for (it = model->next; it != model; it = it->next) {
830830
if (cb(it, user_data) == BT_MESH_WALK_STOP) {
831831
return;
832832
}

0 commit comments

Comments
 (0)