aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-15 19:38:51 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-15 19:38:51 +0000
commit37a2ab558b47b17df75d40173e3f027378c0ed22 (patch)
treecab39d79c3a74326ea0170a839abc25d97310cd4 /channels
parent7e219681d6fa3d94f67756bdac3083fec8390613 (diff)
Hold call structure lock in places where a qualify or peer action can destroy it.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@48504 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_iax2.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index da251faa5..755dc6d93 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -7664,7 +7664,9 @@ static int iax2_do_register(struct iax2_registry *reg)
* call has the pointer to IP and must be updated to the new one
*/
if (reg->dnsmgr && ast_dnsmgr_changed(reg->dnsmgr) && (reg->callno > 0)) {
+ ast_mutex_lock(&iaxsl[reg->callno]);
iax2_destroy(reg->callno);
+ ast_mutex_unlock(&iaxsl[reg->callno]);
reg->callno = 0;
}
if (!reg->addr.sin_addr.s_addr) {
@@ -7830,8 +7832,11 @@ static void __iax2_poke_noanswer(void *data)
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: IAX2/%s\r\nPeerStatus: Unreachable\r\nTime: %d\r\n", peer->name, peer->lastms);
ast_device_state_changed("IAX2/%s", peer->name); /* Activate notification */
}
- if (peer->callno > 0)
+ if (peer->callno > 0) {
+ ast_mutex_lock(&iaxsl[peer->callno]);
iax2_destroy(peer->callno);
+ ast_mutex_unlock(&iaxsl[peer->callno]);
+ }
peer->callno = 0;
peer->lastms = -1;
/* Try again quickly */
@@ -7862,7 +7867,9 @@ static int iax2_poke_peer(struct iax2_peer *peer, int heldcall)
}
if (peer->callno > 0) {
ast_log(LOG_NOTICE, "Still have a callno...\n");
+ ast_mutex_lock(&iaxsl[peer->callno]);
iax2_destroy(peer->callno);
+ ast_mutex_unlock(&iaxsl[peer->callno]);
}
if (heldcall)
ast_mutex_unlock(&iaxsl[heldcall]);
@@ -8703,8 +8710,11 @@ static void destroy_peer(struct iax2_peer *peer)
ast_sched_del(sched, peer->expire);
if (peer->pokeexpire > -1)
ast_sched_del(sched, peer->pokeexpire);
- if (peer->callno > 0)
+ if (peer->callno > 0) {
+ ast_mutex_lock(&iaxsl[peer->callno]);
iax2_destroy(peer->callno);
+ ast_mutex_unlock(&iaxsl[peer->callno]);
+ }
register_peer_exten(peer, 0);