Skip to content

Conversation

@sjanc
Copy link
Contributor

@sjanc sjanc commented Oct 4, 2021

bt_mesh_proxy_role_setup() is called conditionally when peer is
connected and gatt_disconnected() is always called. This leads
to unbalance in role->conn reference count and crash.

Instead of hot-fixing this in gatt_disconnected(), this commit adds
proper bt_mesh_proxy_role_cleanup() API that is called by roles
implementations if cleanup is needed.

Signed-off-by: Szymon Janc [email protected]

bt_mesh_proxy_role_setup() is called conditionally when peer is
connected and gatt_disconnected() is always called. This leads
to unbalance in role->conn reference count and crash.

Instead of hot-fixing this in gatt_disconnected(), this commit adds
proper bt_mesh_proxy_role_cleanup() API that is called by roles
implementations if cleanup is needed.

Signed-off-by: Szymon Janc <[email protected]>
@sjanc
Copy link
Contributor Author

sjanc commented Oct 4, 2021

Fixes crash introduced by #36871

@carlescufi carlescufi merged commit 088fac7 into zephyrproject-rtos:main Oct 4, 2021
@sjanc sjanc deleted the mesh_crash branch October 4, 2021 16:52
}

cli = NULL;
if (cli) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply. Your modification is very good, but I have a little doubt: Since there is no environment support of BBSIM, I can only simply test the functions of PB-GATT and Proxy locally, and it seems that there is no crash.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is very easy to reproduce the crash before this fix: just connect as a central to any device that doesn't support PB-GATT and disconnect.

(we noticed this in autopts run where all BLE Host tests that IUT is central were failing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants