Skip to content
Commit b1da312e authored by Jonathan Rico's avatar Jonathan Rico Committed by Fabio Baltieri
Browse files

Bluetooth: ATT: discard RX on a disconnected connection



A race condition between ATT RX and the connection teardown can happen, as
the teardown is executed from a workqueue.

For example:
- connection is established
- `connected` cb is called (in BT RX context)
- user calls `bt_conn_disconnect` in that cb
- connection is marked as disconnecting
- ATT teardown & general conn cleanup is scheduled
- BT RX gets an ATT request, tries to handle it
- ATT bearer is still not GC'd, so it tries and fails to send it
  -> results in error message "not connected" on log
- ATT teardown & general conn cleanup runs

To avoid that, we not only check the bearer state, but also its ACL conn
state.

Signed-off-by: default avatarJonathan Rico <jonathan.rico@nordicsemi.no>
parent e50748b6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment