[Asterisk-code-review] loader: Prevent deadlock using tab completion. (asterisk[master])
N A
asteriskteam at digium.com
Tue May 3 07:47:25 CDT 2022
N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18522 )
Change subject: loader: Prevent deadlock using tab completion.
......................................................................
loader: Prevent deadlock using tab completion.
If tab completion using ast_module_helper is attempted
during startup, deadlock will ensue because the CLI
will attempt to lock the module list while it is already
locked by the loader. This causes deadlock because when
the loader tries to acquire the CLI lock, they are blocked
on each other.
Waiting for startup to complete is not feasible because
the CLI lock is acquired while waiting, so deadlock will
ensure regardless of whether or not a lock on the module
list is attempted.
To prevent deadlock, we immediately abort if tab completion
is attempted on the module list.
ASTERISK-30039 #close
Change-Id: Idd468906c512bb196631e366a8f597a0e2e9271d
---
M main/loader.c
1 file changed, 5 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/22/18522/1
diff --git a/main/loader.c b/main/loader.c
index aafcd3b..8c664e2 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -1382,6 +1382,11 @@
return NULL;
}
+ /* Tab completion can't be used during startup, or CLI and loader will deadlock. */
+ if (!ast_test_flag(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)) {
+ return NULL;
+ }
+
if (type == AST_MODULE_HELPER_LOAD) {
module_load_helper(word);
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18522
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Idd468906c512bb196631e366a8f597a0e2e9271d
Gerrit-Change-Number: 18522
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220503/f3a8bcba/attachment.html>
More information about the asterisk-code-review
mailing list