Skip to contentSkip to conversation

mesh: Fix configuration update when deleting an AppKey

PATCH New Inga Stotland 1 participant 1 message Dec 12, 2019 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mesh: Fix configuration update when deleting an AppKey

When an AppKey is deleted from a node, the configuration update is sent to the element model only if the model was bound to this AppKey.

---
 mesh/model.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
mesh/model.c +3 -2
index acdd94f7b..d998a9caa 100644
@@ -650,7 +650,7 @@ static void model_unbind_idx(struct mesh_node *node, struct mesh_model *mod,
 		/* Internal model */
 		mod->cbs->bind(idx, ACTION_DELETE);
 
-	if (mod->pub && idx != mod->pub->idx)
+	if (!mod->pub || idx != mod->pub->idx)
 		return;
 
 	/* Remove model publication if the publication key is unbound */
@@ -1319,7 +1319,8 @@ void mesh_model_app_key_delete(struct mesh_node *node, struct l_queue *models,
 	for (; entry; entry = entry->next) {
 		struct mesh_model *model = entry->data;
 
-		model_unbind_idx(node, model, app_idx);
+		if (has_binding(model->bindings, app_idx))
+			model_unbind_idx(node, model, app_idx);
 	}
 }
 
Signature · 1 line
2.21.0