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>
4 files changed