mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-03 19:16:46 +00:00
core_unreal: Fix deadlock with T.38 control frames.
When using the ast_unreal_lock_all function no channel locks can be held before calling it. This change unlocks the channel that indicate was called on before doing so and then relocks it afterwards. ASTERISK-29035 Change-Id: Id65016201b5f9c9519a216e250f9101c629e19e9
This commit is contained in:
committed by
Joshua Colp
parent
f213833514
commit
ed2f637b47
@@ -710,6 +710,7 @@ int ast_unreal_indicate(struct ast_channel *ast, int condition, const void *data
|
|||||||
* signaling and we need to be sure that the locking order is the same to prevent possible
|
* signaling and we need to be sure that the locking order is the same to prevent possible
|
||||||
* deadlocks.
|
* deadlocks.
|
||||||
*/
|
*/
|
||||||
|
ast_channel_unlock(ast);
|
||||||
ast_unreal_lock_all(p, &chan, &owner);
|
ast_unreal_lock_all(p, &chan, &owner);
|
||||||
|
|
||||||
if (owner) {
|
if (owner) {
|
||||||
@@ -726,12 +727,14 @@ int ast_unreal_indicate(struct ast_channel *ast, int condition, const void *data
|
|||||||
}
|
}
|
||||||
|
|
||||||
ao2_unlock(p);
|
ao2_unlock(p);
|
||||||
|
ast_channel_lock(ast);
|
||||||
} else if (parameters->request_response == AST_T38_TERMINATED) {
|
} else if (parameters->request_response == AST_T38_TERMINATED) {
|
||||||
/*
|
/*
|
||||||
* Lock both parts of the local channel so we can restore their topologies to the original.
|
* Lock both parts of the local channel so we can restore their topologies to the original.
|
||||||
* The topology should be on the unreal_pvt structure, with a ref that we can steal. Same
|
* The topology should be on the unreal_pvt structure, with a ref that we can steal. Same
|
||||||
* conditions as above.
|
* conditions as above.
|
||||||
*/
|
*/
|
||||||
|
ast_channel_unlock(ast);
|
||||||
ast_unreal_lock_all(p, &chan, &owner);
|
ast_unreal_lock_all(p, &chan, &owner);
|
||||||
|
|
||||||
if (owner) {
|
if (owner) {
|
||||||
@@ -745,6 +748,7 @@ int ast_unreal_indicate(struct ast_channel *ast, int condition, const void *data
|
|||||||
}
|
}
|
||||||
|
|
||||||
ao2_unlock(p);
|
ao2_unlock(p);
|
||||||
|
ast_channel_lock(ast);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user