diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2010-07-03 02:36:31 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2010-07-03 02:36:31 +0000 |
commit | f4d96da591d8aa471ed1e4b4e1083eb7b301ee22 (patch) | |
tree | 4cab9f3225524ceb648e7d61ebc9af4ec5437d87 /channels | |
parent | d31612410d2d603c6e2b6aeb1feed5bbeefc150e (diff) |
Merged revisions 273793 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r273793 | tilghman | 2010-07-02 16:36:39 -0500 (Fri, 02 Jul 2010) | 9 lines
Have the DEADLOCK_AVOIDANCE macro warn when an unlock fails, to help catch potentially large software bugs.
(closes issue #17407)
Reported by: pdf
Patches:
20100527__issue17407.diff.txt uploaded by tilghman (license 14)
Review: https://reviewboard.asterisk.org/r/751/
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@273830 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_agent.c | 7 | ||||
-rw-r--r-- | channels/chan_h323.c | 2 | ||||
-rw-r--r-- | channels/chan_local.c | 6 |
3 files changed, 12 insertions, 3 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c index 3451de220..fd05bed19 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -715,7 +715,12 @@ static int agent_indicate(struct ast_channel *ast, int condition, const void *da ast_mutex_lock(&p->lock); if (p->chan && !ast_check_hangup(p->chan)) { while (ast_channel_trylock(p->chan)) { - ast_channel_unlock(ast); + int res; + if ((res = ast_channel_unlock(ast))) { + ast_log(LOG_ERROR, "chan_agent bug! Channel was not locked upon entry to agent_indicate: %s\n", strerror(res)); + ast_mutex_unlock(&p->lock); + return -1; + } usleep(1); ast_channel_lock(ast); } diff --git a/channels/chan_h323.c b/channels/chan_h323.c index 3d07bceb4..10234199a 100644 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -306,7 +306,7 @@ static int oh323_simulate_dtmf_end(const void *data) if (pvt) { ast_mutex_lock(&pvt->lock); /* Don't hold pvt lock while trying to lock the channel */ - while(pvt->owner && ast_channel_trylock(pvt->owner)) { + while (pvt->owner && ast_channel_trylock(pvt->owner)) { DEADLOCK_AVOIDANCE(&pvt->lock); } diff --git a/channels/chan_local.c b/channels/chan_local.c index e17cc2737..c3723947e 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -250,7 +250,11 @@ static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_fra /* Ensure that we have both channels locked */ while (other && ast_channel_trylock(other)) { - ast_mutex_unlock(&p->lock); + int res; + if ((res = ast_mutex_unlock(&p->lock))) { + ast_log(LOG_ERROR, "chan_local bug! '&p->lock' was not locked when entering local_queue_frame! (%s)\n", strerror(res)); + return -1; + } if (us && us_locked) { do { CHANNEL_DEADLOCK_AVOIDANCE(us); |