Bluetooth: Mesh: Fix crash on disconnect
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 <szymon.janc@codecoup.pl>
This commit is contained in:
parent
072c8f2c68
commit
088fac76ed
4 changed files with 10 additions and 13 deletions
|
@ -883,7 +883,10 @@ static void gatt_disconnected(struct bt_conn *conn, uint8_t reason)
|
|||
conn_count--;
|
||||
|
||||
client = find_client(conn);
|
||||
client->cli = NULL;
|
||||
if (client->cli) {
|
||||
bt_mesh_proxy_role_cleanup(client->cli);
|
||||
client->cli = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int proxy_send(struct bt_conn *conn,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue