summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-02-28 17:17:35 +0000
committerMatthew Jordan <mjordan@digium.com>2013-02-28 17:17:35 +0000
commit1a34b465bc98e40afc7118f9f63e4f9839e5c908 (patch)
tree8724a3d21096fdde16a47e17a639919b65336cf3 /channels
parent62f7acfac6e248ff0087e15a058ea575cd78e05c (diff)
Prevent deadlock in chan_iax2 when attempting to set caller ID
A deadlock can occur in chan_iax2 when it attempts to set the caller ID, as it already holds the iax2 private lock and improperly fails to obtain the channel lock before calling ast_set_callerid. By not safely obtaining the channel lock, a locking inversion can take place, causing a deadlock. This patch solves this by calling the required deadlock avoidance functions that obtain the channel lock before setting the caller ID. Thanks to Pavel for fixing my syntax errors and testing this patch out. (closes issue ASTERISK-21128) Reported by: Pavel Troller Tested by: Pavel Troller patches: ASTERISK-21128-1.8.diff uploaded by mjordan (license 6283) ASTERISK-21128-modified-1.8.diff uploaded by Pavel Troller (license 6302) ........ Merged revisions 382233 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 382234 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382236 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_iax2.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 5eb273f8d..5a307bf0c 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -11573,13 +11573,15 @@ immediatedial:
ast_string_field_set(iaxs[fr->callno], cid_name, connected.id.name.str);
iaxs[fr->callno]->calling_pres = ast_party_id_presentation(&connected.id);
- if (iaxs[fr->callno]->owner) {
+ iax2_lock_owner(fr->callno);
+ if (iaxs[fr->callno] && iaxs[fr->callno]->owner) {
ast_set_callerid(iaxs[fr->callno]->owner,
S_COR(connected.id.number.valid, connected.id.number.str, ""),
S_COR(connected.id.name.valid, connected.id.name.str, ""),
NULL);
ast_channel_caller(iaxs[fr->callno]->owner)->id.number.presentation = connected.id.number.presentation;
ast_channel_caller(iaxs[fr->callno]->owner)->id.name.presentation = connected.id.name.presentation;
+ ast_channel_unlock(iaxs[fr->callno]->owner);
}
}
ast_party_connected_line_free(&connected);