Skip to content

Commit b347845

Browse files
committed
nrf_rpc: fix initialization corner case
When initializing multiple groups that share the same transport, it may happen that a device receives an init packet for a group whose internal members have not been initialized yet, leading to the bus fault. Make sure that internal members of all groups have been initialized before ANY transport is started to prevent that. Signed-off-by: Damian Krolik <[email protected]>
1 parent 7aa44cd commit b347845

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

nrf_rpc/nrf_rpc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,13 @@ static int transport_init(nrf_rpc_tr_receive_handler_t receive_cb)
438438
}
439439
}
440440

441+
}
442+
443+
for (NRF_RPC_AUTO_ARR_FOR(iter, group, &nrf_rpc_groups_array,
444+
const struct nrf_rpc_group)) {
445+
const struct nrf_rpc_tr *transport = group->transport;
446+
struct nrf_rpc_group_data *data = group->data;
447+
441448
err = transport->api->init(transport, receive_cb, NULL);
442449
if (err) {
443450
NRF_RPC_ERR("Failed to initialize transport, err: %d", err);

0 commit comments

Comments
 (0)