[asterisk-commits] res fax.c: Fix deadlock in fax gateway indicate t38(). (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 26 14:02:59 CDT 2016


Joshua Colp has submitted this change and it was merged.

Change subject: res_fax.c: Fix deadlock in fax_gateway_indicate_t38().
......................................................................


res_fax.c: Fix deadlock in fax_gateway_indicate_t38().

fax_gateway_indicate_t38() calls ast_indicate_data() which cannot be
called with any channel locks already held.  A deadlock can happen if the
function is operating on a local channel.

* Made fax_gateway_indicate_t38() unlock the channel before calling
ast_indicate_data() since fax_gateway_indicate_t38() is always called with
the channel locked.

* Made fax_gateway_indicate_t38() return void since nothing cared about
its return value.

ASTERISK-26203
Reported by: Etienne Lessard

ASTERISK-24822
Reported by: David Brillert

ASTERISK-22732
Reported by: Richard Mudgett

Change-Id: I701ff2d26c5fc23e0d5a48a3fd98759a9fd09407
---
M res/res_fax.c
1 file changed, 6 insertions(+), 3 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/res/res_fax.c b/res/res_fax.c
index 94c512d..5bbc896 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -3001,12 +3001,15 @@
 	return f;
 }
 
-static int fax_gateway_indicate_t38(struct ast_channel *chan, struct ast_channel *active, struct ast_control_t38_parameters *control_params)
+/*! \pre chan is locked on entry */
+static void fax_gateway_indicate_t38(struct ast_channel *chan, struct ast_channel *active, struct ast_control_t38_parameters *control_params)
 {
 	if (active == chan) {
-		return ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, control_params, sizeof(*control_params));
+		ast_channel_unlock(chan);
+		ast_indicate_data(chan, AST_CONTROL_T38_PARAMETERS, control_params, sizeof(*control_params));
+		ast_channel_lock(chan);
 	} else {
-		return ast_queue_control_data(chan, AST_CONTROL_T38_PARAMETERS, control_params, sizeof(*control_params));
+		ast_queue_control_data(chan, AST_CONTROL_T38_PARAMETERS, control_params, sizeof(*control_params));
 	}
 }
 

-- 
To view, visit https://gerrit.asterisk.org/3721
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I701ff2d26c5fc23e0d5a48a3fd98759a9fd09407
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list