aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-07 16:13:23 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-07 16:13:23 +0000
commit3de152d0d38c38f13a5dc6c442723d8dd73ba9e8 (patch)
tree73a558acf40a572dc1d942ab8272df05700e2f3e /main
parentead28e0e9a09b6fd81bdf91dd99812eb7f6ae406 (diff)
Merged revisions 113066 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r113066 | mmichelson | 2008-04-07 11:12:30 -0500 (Mon, 07 Apr 2008) | 21 lines Merged revisions 113065 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r113065 | mmichelson | 2008-04-07 11:08:45 -0500 (Mon, 07 Apr 2008) | 13 lines This fix prevents a deadlock that was experienced in chan_local. There was deadlock prevention in place in chan_local, but it would not work in a specific case because the channel was recursively locked. By unlocking the channel prior to calling the generator's generate callback in ast_read_generator_actions(), we prevent the recursive locking, and therefore the deadlock. (closes issue #12307) Reported by: callguy Patches: 12307.patch uploaded by putnopvut (license 60) Tested by: callguy ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@113067 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/channel.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index 920ee37dd..478d9bdd8 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -2273,7 +2273,17 @@ static void ast_read_generator_actions(struct ast_channel *chan, struct ast_fram
} else {
samples = f->samples;
}
+ /* This unlock is here based on two assumptions that hold true at this point in the
+ * code. 1) this function is only called from within __ast_read() and 2) all generators
+ * call ast_write() in their generate callback.
+ *
+ * The reason this is added is so that when ast_write is called, the lock that occurs
+ * there will not recursively lock the channel. Doing this will cause intended deadlock
+ * avoidance not to work in deeper functions
+ */
+ ast_channel_unlock(chan);
res = chan->generator->generate(chan, tmp, f->datalen, samples);
+ ast_channel_lock(chan);
chan->generatordata = tmp;
if (res) {
if (option_debug > 1)