]> git.ipfire.org Git - thirdparty/asterisk.git/commit
pbx: Fix hints deadlock between reload and ExtensionState.
authorJoshua C. Colp <jcolp@sangoma.com>
Thu, 27 Aug 2020 10:31:40 +0000 (07:31 -0300)
committerJoshua Colp <jcolp@sangoma.com>
Fri, 28 Aug 2020 09:32:14 +0000 (04:32 -0500)
commitfe36d638bb5f8489861b1a220b24cc511be33341
treecddfb5e8075ea808c293fbe6a23e07e07d531ca8
parent9aeb36af5ba5141f42e059fd212da18b1c86eefa
pbx: Fix hints deadlock between reload and ExtensionState.

When the ExtensionState AMI action is executed on a pattern matched
hint it can end up adding a new hint if one does not already exist.
This results in a locking order of contexts -> hints -> contexts.

If at the same time a reload is occurring and adding its own hint
it will have a locking order of hints -> contexts.

This results in a deadlock as one thread wants a lock on contexts
that the other has, and the other thread wants a lock on hints
that the other has.

This change enforces a hints -> contexts locking order by explicitly
locking hints in the places where a hint is added when queried for.
This matches the order seen through normal adding of hints.

ASTERISK-29046

Change-Id: I49f027f4aab5d2d50855ae937bcf5e2fd8bfc504
main/pbx.c