summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2011-11-09 20:55:43 +0000
committerRichard Mudgett <rmudgett@digium.com>2011-11-09 20:55:43 +0000
commit6d481420ce07ea171736f891bed54828a5173789 (patch)
treed1b92318cde73b71889db083953ba4abe528c659 /channels
parent04f04ff39d8067c836c0a19120113ab1c210a5ae (diff)
Fix deadlock during dialplan reload.
Another deadlock between the conlock/hints and channels/channel locking orders. * Don't hold the channel and private lock in sip_new() when calling ast_exists_extension(). (closes issue ASTERISK-18740) Reported by: Byron Clark Patches: sip_exists_exten_dlock_3.diff (license #5041) patch uploaded by Gregory Hinton Nietsky ASTERISK-18740.patch (license #6157) patch uploaded by Byron Clark Tested by: Byron Clark ........ Merged revisions 344268 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 344271 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@344272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index ef97d9173..6629ce14d 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -6975,7 +6975,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
int needvideo = 0;
int needtext = 0;
char buf[SIPBUFSIZE];
- char *decoded_exten;
+ char *exten;
{
const char *my_name; /* pick a good name */
@@ -7125,14 +7125,15 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
* we should decode the uri before storing it in the channel, but leave it encoded in the sip_pvt
* structure so that there aren't issues when forming URI's
*/
- if (ast_exists_extension(NULL, i->context, i->exten, 1, i->cid_num)) {
- /* encoded in dialplan, so keep extension encoded */
- ast_copy_string(tmp->exten, i->exten, sizeof(tmp->exten));
- } else {
- decoded_exten = ast_strdupa(i->exten);
- ast_uri_decode(decoded_exten, ast_uri_sip_user);
- ast_copy_string(tmp->exten, decoded_exten, sizeof(tmp->exten));
+ exten = ast_strdupa(i->exten);
+ sip_pvt_unlock(i);
+ ast_channel_unlock(tmp);
+ if (!ast_exists_extension(NULL, i->context, i->exten, 1, i->cid_num)) {
+ ast_uri_decode(exten, ast_uri_sip_user);
}
+ ast_channel_lock(tmp);
+ sip_pvt_lock(i);
+ ast_copy_string(tmp->exten, exten, sizeof(tmp->exten));
/* Don't use ast_set_callerid() here because it will
* generate an unnecessary NewCallerID event */