Sfoglia il codice sorgente

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
Daniel-Constantin Mierla 11 anni fa
parent
commit
a8d50919bd
1 ha cambiato i file con 8 aggiunte e 1 eliminazioni
  1. 8 1
      modules/tm/tm.c

+ 8 - 1
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 */
 	}