[asterisk-commits] mjordan: branch 11 r382234 - in /branches/11: ./ channels/chan_iax2.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Feb 28 11:16:35 CST 2013
Author: mjordan
Date: Thu Feb 28 11:16:31 2013
New Revision: 382234
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382234
Log:
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
Modified:
branches/11/ (props changed)
branches/11/channels/chan_iax2.c
Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/11/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_iax2.c?view=diff&rev=382234&r1=382233&r2=382234
==============================================================================
--- branches/11/channels/chan_iax2.c (original)
+++ branches/11/channels/chan_iax2.c Thu Feb 28 11:16:31 2013
@@ -11744,13 +11744,15 @@
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);
More information about the asterisk-commits
mailing list