mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-11-03 11:02:46 +00:00
mesh: avoid improper access to internal structures
Nothing in the API description the delayed work structure sanctions direct reference to internal fields. Do not assume that a delayed work item can be submitted without delay by invoking k_work_submit() with a reference to the contained work item. Instead submit with the delayed API and no wait. This is port of cd2a5dd6124940f1be5345cc4dae800808a08d1f
This commit is contained in:
committed by
Łukasz Rymanowski
parent
44bdd1dcea
commit
935509a42a
@@ -438,7 +438,7 @@ void bt_mesh_beacon_ivu_initiator(bool enable)
|
||||
atomic_set_bit_to(bt_mesh.flags, BT_MESH_IVU_INITIATOR, enable);
|
||||
|
||||
if (enable) {
|
||||
k_work_submit(&beacon_timer.work);
|
||||
k_delayed_work_submit(&beacon_timer, K_NO_WAIT);
|
||||
} else if (!bt_mesh_beacon_enabled()) {
|
||||
k_delayed_work_cancel(&beacon_timer);
|
||||
}
|
||||
@@ -455,13 +455,13 @@ static void subnet_beacon_enable(struct bt_mesh_subnet *sub)
|
||||
void bt_mesh_beacon_enable(void)
|
||||
{
|
||||
if (!bt_mesh_is_provisioned()) {
|
||||
k_work_submit(&beacon_timer.work);
|
||||
k_delayed_work_submit(&beacon_timer, K_NO_WAIT);
|
||||
return;
|
||||
}
|
||||
|
||||
bt_mesh_subnet_foreach(subnet_beacon_enable);
|
||||
|
||||
k_work_submit(&beacon_timer.work);
|
||||
k_delayed_work_submit(&beacon_timer, K_NO_WAIT);
|
||||
}
|
||||
|
||||
void bt_mesh_beacon_disable(void)
|
||||
|
||||
@@ -236,7 +236,7 @@ uint8_t bt_mesh_hb_pub_set(struct bt_mesh_hb_pub *new_pub)
|
||||
* periodic publishing.
|
||||
*/
|
||||
if (pub.period && pub.count) {
|
||||
k_work_submit(&pub_timer.work);
|
||||
k_delayed_work_submit(&pub_timer, K_NO_WAIT);
|
||||
} else {
|
||||
k_delayed_work_cancel(&pub_timer);
|
||||
}
|
||||
@@ -333,7 +333,7 @@ void bt_mesh_hb_start(void)
|
||||
{
|
||||
if (pub.count && pub.period) {
|
||||
BT_DBG("Starting heartbeat publication");
|
||||
k_work_submit(&pub_timer.work);
|
||||
k_delayed_work_submit(&pub_timer, K_NO_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,6 +346,6 @@ void bt_mesh_hb_resume(void)
|
||||
{
|
||||
if (pub.period && pub.count) {
|
||||
BT_DBG("Starting heartbeat publication");
|
||||
k_work_submit(&pub_timer.work);
|
||||
k_delayed_work_submit(&pub_timer, K_NO_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user