Fix deadlock potential with ast_set_hangupsource() calls.

Calling ast_set_hangupsource() with the channel lock held can result in a
deadlock because the function also locks the bridged channel.

(issue ASTERISK-19537)

(closes issue AST-891)
Reported by: Guenther Kelleter
Tested by: Guenther Kelleter

(closes issue ASTERISK-19801)
Reported by: Alec Davis
........

Merged revisions 368759 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 368760 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@368772 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2012-06-11 17:34:08 +00:00
parent c6142cf2cc
commit 72eb8eb1e7
6 changed files with 83 additions and 19 deletions

View File

@@ -3623,7 +3623,18 @@ struct ast_frame *analog_exception(struct analog_pvt *p, struct ast_channel *ast
f = &p->subs[idx].f;
return f;
}
f = __analog_handle_event(p, ast);
if (!f) {
const char *name = ast_strdupa(ast_channel_name(ast));
/* Tell the CDR this DAHDI device hung up */
analog_unlock_private(p);
ast_channel_unlock(ast);
ast_set_hangupsource(ast, name, 0);
ast_channel_lock(ast);
analog_lock_private(p);
}
return f;
}