Kaynağa Gözat

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

(cherry picked from commit a8d50919bd614b704f3a4e08ff90d844b2c29829)
(cherry picked from commit 631e558f97728b91b3c0b3341c6c4ecc16902a82)
(cherry picked from commit 313458e92f9ab9db32bad31abed6b73f0e35a1e1)
Daniel-Constantin Mierla 11 yıl önce
ebeveyn
işleme
c9c537a663
1 değiştirilmiş dosya ile 8 ekleme ve 1 silme
  1. 8 1
      modules/tm/tm.c

+ 8 - 1
modules/tm/tm.c

@@ -2043,6 +2043,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;
@@ -2074,7 +2081,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 */
 	}