]> 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)
committerGeorge Joseph <gjoseph@digium.com>
Fri, 28 Aug 2020 17:37:24 +0000 (12:37 -0500)
commit28bae5e901b2595cac7b159734762128a2c591fe
tree643bc74c49f02b0cd1e43b1f4f973be941d56cac
parent54ddf191418d8ec990f2b1a2ceed0352fd3c0d0d
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