ble_mesh: Fix provisioning buffer initialization [Zephyr]

When PB-GATT support has been enabled the provisioning code "borrows"
the buffer from the proxy code. However, the way that initialization
was happening the proxy buffers were initialized only after
provisioning initialization, resulting in a corrupted buffer with
buf->data pointing to NULL. Reorder the initialization calls so that
proxy is done first and provisioning only after it.
This commit is contained in:
lly 2020-03-25 00:10:59 +08:00 committed by bot
parent e580f98b44
commit abcfcc47ec

View File

@ -334,6 +334,19 @@ int bt_mesh_init(const struct bt_mesh_prov *prov,
bt_mesh_gatt_init();
}
if (IS_ENABLED(CONFIG_BLE_MESH_PROXY)) {
if ((IS_ENABLED(CONFIG_BLE_MESH_NODE) &&
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) ||
IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) {
bt_mesh_proxy_init();
}
if ((IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) &&
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) ||
IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT)) {
bt_mesh_proxy_prov_client_init();
}
}
if (IS_ENABLED(CONFIG_BLE_MESH_PROV)) {
if (IS_ENABLED(CONFIG_BLE_MESH_NODE)) {
err = bt_mesh_prov_init(prov);
@ -363,19 +376,6 @@ int bt_mesh_init(const struct bt_mesh_prov *prov,
bt_mesh_adv_init();
if (IS_ENABLED(CONFIG_BLE_MESH_PROXY)) {
if ((IS_ENABLED(CONFIG_BLE_MESH_NODE) &&
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) ||
IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) {
bt_mesh_proxy_init();
}
if ((IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) &&
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) ||
IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT)) {
bt_mesh_proxy_prov_client_init();
}
}
if (IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER)) {
bt_mesh_provisioner_init();
}