diff mbox series

[BlueZ] mesh: Fix node when loading from storage

Message ID 20230310013512.425033-1-inga.stotland@intel.com (mailing list archive)
State Accepted
Commit 40576ac1badffb151ada76a90b89e85aa2ed9934
Headers show
Series [BlueZ] mesh: Fix node when loading from storage | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Stotland, Inga March 10, 2023, 1:35 a.m. UTC
From: Inga Stotland <inga.stotland@gmail.com>

This fixes adding mandatory models (config server, remote provisioner)
to a node whose configuration is being loaded from storage:
mesh_model_add() was called with a wrong argument.

Was:     mesh_model_add(..., PRIMARY_ELE_IDX, ...);
Correct: mesh_model_add(..., ele->models, ...);
---
 mesh/node.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

bluez.test.bot@gmail.com March 10, 2023, 3:40 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=728452

---Test result---

Test Summary:
CheckPatch                    PASS      0.40 seconds
GitLint                       PASS      0.27 seconds
BuildEll                      PASS      26.16 seconds
BluezMake                     PASS      745.72 seconds
MakeCheck                     PASS      10.96 seconds
MakeDistcheck                 PASS      147.51 seconds
CheckValgrind                 PASS      239.18 seconds
CheckSmatch                   PASS      319.60 seconds
bluezmakeextell               PASS      95.81 seconds
IncrementalBuild              PASS      603.73 seconds
ScanBuild                     PASS      955.19 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org March 12, 2023, 7:10 p.m. UTC | #2
Hello:

This patch was applied to bluetooth/bluez.git (master)
by Brian Gix <brian.gix@gmail.com>:

On Thu,  9 Mar 2023 17:35:12 -0800 you wrote:
> From: Inga Stotland <inga.stotland@gmail.com>
> 
> This fixes adding mandatory models (config server, remote provisioner)
> to a node whose configuration is being loaded from storage:
> mesh_model_add() was called with a wrong argument.
> 
> Was:     mesh_model_add(..., PRIMARY_ELE_IDX, ...);
> Correct: mesh_model_add(..., ele->models, ...);
> 
> [...]

Here is the summary with links:
  - [BlueZ] mesh: Fix node when loading from storage
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=40576ac1badf

You are awesome, thank you!
diff mbox series

Patch

diff --git a/mesh/node.c b/mesh/node.c
index ed3212685..93537c5ba 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -347,6 +347,7 @@  static bool add_elements_from_storage(struct mesh_node *node,
 					struct mesh_config_node *db_node)
 {
 	const struct l_queue_entry *entry;
+	struct node_element *ele;
 
 	entry = l_queue_get_entries(db_node->elements);
 
@@ -354,14 +355,19 @@  static bool add_elements_from_storage(struct mesh_node *node,
 		if (!add_element_from_storage(node, entry->data))
 			return false;
 
+	ele = l_queue_find(node->elements, match_element_idx,
+						L_UINT_TO_PTR(PRIMARY_ELE_IDX));
+	if (!ele)
+		return false;
+
 	/* Add configuration server model on the primary element */
-	mesh_model_add(node, PRIMARY_ELE_IDX, CONFIG_SRV_MODEL, NULL);
+	mesh_model_add(node, ele->models, CONFIG_SRV_MODEL, NULL);
 
 	/* Add remote provisioning models on the primary element */
-	mesh_model_add(node, PRIMARY_ELE_IDX, REM_PROV_SRV_MODEL, NULL);
+	mesh_model_add(node, ele->models, REM_PROV_SRV_MODEL, NULL);
 
 	if (node->provisioner)
-		mesh_model_add(node, PRIMARY_ELE_IDX, REM_PROV_CLI_MODEL, NULL);
+		mesh_model_add(node, ele->models, REM_PROV_CLI_MODEL, NULL);
 
 	return true;
 }