]> git.ipfire.org Git - thirdparty/asterisk.git/commit
stasis.c: Fix deadlock in stasis_topic_pool_get_topic during module load
authorphoneben <3232963@gmail.com>
Sat, 29 Nov 2025 18:08:13 +0000 (20:08 +0200)
committerphoneben <3232963@gmail.com>
Mon, 26 Jan 2026 20:33:21 +0000 (20:33 +0000)
commitb4e200dc2fc252fb32f6bdf9c0810dc2462f6212
tree0332a111aae8ca7316d5bb0f2f37da49f445f00a
parent9496fe61b19eb287f8f3b2a2af62d0451829223a
stasis.c: Fix deadlock in stasis_topic_pool_get_topic during module load

stasis.c: Fix deadlock in stasis_topic_pool_get_topic during module load.

Deadlock occurs when res_manager_devicestate loads concurrently with
device state operations due to lock ordering violation:

Thread 1: Holds pool lock → needs topic lock (in stasis_forward_all)
Thread 2: Holds topic lock → needs pool lock (in stasis_topic_pool_get_topic)

Fix: Release pool lock before calling stasis_topic_create() and
stasis_forward_all(). Re-acquire only for insertion with race check.

Preserves borrowed reference semantics while breaking the deadlock cycle.

Fixes: #1611
main/stasis.c