zephyr/subsys/bluetooth
Aleksander Wasaznik 30098c881f Bluetooth: Host: Detect deadlock in bt_att_req_alloc
`gatt_req_alloc` will wait until a `req` is free (or until timeout).
`req`s are freed on the BT RX thread in calls into bt_att_recv.

When `gatt_req_alloc` called on the BT RX thread itself when there are
no free `req`s, it will block the BT RX thread and deadlock. The
deadlock lasts until timeout.

This change detects this condition and returns the failure early.

Fixes https://github.com/zephyrproject-rtos/zephyr/issues/39624 where
if `bt_gatt_write` is called from BT RX thread (as can happen if it is
called from a bluetooth callback), the BT RX thread can be blocked and
prevented from processing the request responses and unblocking itself.
This was the cause of a soft 30s deadlock until gatt_req_alloc timeouts.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-01-27 16:04:24 +01:00
..
audio Bluetooth: Audio: Add BT_WARN for missing stream callbacks 2022-01-27 12:01:34 +02:00
common logging: Deprecate v1, default to v2 2022-01-17 15:49:10 -05:00
controller Bluetooth: Controller: Fix Periodic Advertising to setup Power Amp 2022-01-27 14:02:01 +01:00
host Bluetooth: Host: Detect deadlock in bt_att_req_alloc 2022-01-27 16:04:24 +01:00
mesh Bluetooth: Mesh: LPN teminate cb establish clause 2022-01-18 10:41:18 -05:00
services bluetooth: ots: validate OTS procedure sizes 2022-01-12 15:47:20 +01:00
shell Bluetooth: shell: Add LE Audio shell commands 2022-01-27 12:01:34 +02:00
CMakeLists.txt drivers: bluetooth: build as static library 2021-08-17 06:06:03 -04:00
Kconfig bluetooth: correct kconfig help 2021-12-21 18:19:24 +01:00
Kconfig.adv kconfig: bluetooth: experimental settings now uses select EXPERIMENTAL 2021-10-22 13:59:21 +02:00
Kconfig.iso kconfig: bluetooth: experimental settings now uses select EXPERIMENTAL 2021-10-22 13:59:21 +02:00