[sr-dev] git:master: tm: safety catch inside t_check_trans() when already in a tm routing block

Daniel-Constantin Mierla miconda at gmail.com
Thu Oct 30 11:43:22 CET 2014


Module: sip-router
Branch: master
Commit: a8d50919bd614b704f3a4e08ff90d844b2c29829
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a8d50919bd614b704f3a4e08ff90d844b2c29829

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Thu Oct 30 11:41:41 2014 +0100

tm: safety catch inside t_check_trans() when already in a tm routing block

- transaction is known and some of these routing blocks are inside tm
  lock, which can result in deadlock if not tested
- reported by Andrew Pogrebennyk, FS#482

---

 modules/tm/tm.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/modules/tm/tm.c b/modules/tm/tm.c
index f3568c1..d437119 100644
--- a/modules/tm/tm.c
+++ b/modules/tm/tm.c
@@ -2140,6 +2140,13 @@ int t_check_trans(struct sip_msg* msg)
 	int branch;
 	int ret;
 	
+	/* already processing a T */
+	if(get_route_type()==FAILURE_ROUTE
+			|| get_route_type()==BRANCH_ROUTE
+			|| get_route_type()==TM_ONREPLY_ROUTE) {
+		return 1;
+	}
+
 	if (msg->first_line.type==SIP_REPLY) {
 		branch = 0;
 		ret = (t_check_msg( msg , &branch)==1) ? 1 : -1;
@@ -2171,7 +2178,7 @@ int t_check_trans(struct sip_msg* msg)
 				}
 				/* no need for UNREF(t); set_t(0) - the end-of-script
 				   t_unref callback will take care of them */
-				return 0; /* return from the script */
+				return 0; /* exit from the script */
 		}
 		/* not found or error */
 	}




More information about the sr-dev mailing list