]> 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:04 +0000 (04:32 -0500)
commit8d6c2221a982dc879fc07bc7f107101818e4a2f1
treedda5f2c1bd7ef6ec848000eb52c884e3bd2c4a22
parent96106ac286e9648163d74d6d761ccb7fb7d9698f
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