Skip to content
Commit 76015745 authored by Jonathan Rico's avatar Jonathan Rico Committed by Johan Hedberg
Browse files

Bluetooth: ATT: lock scheduler when sending from user thread



`att_req_send_process` is not thread safe.

In the case where the current context is pre-emptible (e.g. when a user
sends something over GATT from the main thread):

The iterator in `att_req_send_process` can get interrupted mid-processing,
breaking the logic and resulting in an assert/crash/data corruption.

Additionally, the connection state check in this fn is also not
thread-safe, the RX thread could pre-empt us and disconnect right before
we attempt to send on an ATT bearer that is on it.

This is a hotfix until we have a generalized solution for the host API
surface. It seems a lot of our logic assumes cooperative priority.

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