From: Russell Bryant Date: Mon, 5 Nov 2007 21:35:51 +0000 (+0000) Subject: Merged revisions 88768 via svnmerge from X-Git-Tag: 1.6.0-beta1~3^2~996 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=44bf97386533fe5b83bed7f1fae5d473682ddb3f;p=thirdparty%2Fasterisk.git Merged revisions 88768 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r88768 | russell | 2007-11-05 15:33:56 -0600 (Mon, 05 Nov 2007) | 8 lines When traversing the list of channel variables here in transmit_invite(), the asterisk channel must be locked, as this data may change at any time. (I have seen numerous reports of crashes related to the handling of channel variables. There are a couple of issues on the bug tracker related to it, but it has also been noted on IRC and mailing lists. So, I am finding and fixing some places where channel variables are handled improperly.) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88769 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 80c8f72e3b..1aff65fc86 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -7752,8 +7752,12 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init) add_header(&req, "Allow", ALLOWED_METHODS); add_header(&req, "Supported", SUPPORTED_EXTENSIONS); if (p->options && p->options->addsipheaders && p->owner) { - struct ast_channel *ast = p->owner; /* The owner channel */ - struct varshead *headp = &ast->varshead; + struct ast_channel *chan = p->owner; /* The owner channel */ + struct varshead *headp; + + ast_channel_lock(chan); + + headp = &chan->varshead; if (!headp) ast_log(LOG_WARNING,"No Headp for the channel...ooops!\n"); @@ -7784,6 +7788,8 @@ static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init) } } } + + ast_channel_unlock(chan); } if (sdp) { if (p->udptl && p->t38.state == T38_LOCAL_DIRECT) {