aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-05 21:33:56 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-05 21:33:56 +0000
commit5c1b77dc882e5c390f879bba6773d6a36d1c5bcd (patch)
treef5ee43ffba24ab7ace3b5bfff1058bbd4d918596 /channels
parent0b92fe4cf86e6aa339469684dce3386bc2f41166 (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.4@88768 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 958680ba7..23fe8f907 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -6954,8 +6954,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");
@@ -6986,6 +6990,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) {