Skip to content

Commit d050570

Browse files
committed
update cloned msg under lock to avoid races with branch injection
1 parent 91c523c commit d050570

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

modules/tm/tm.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,11 +1333,6 @@ static int w_t_relay( struct sip_msg *p_msg , void *flags, struct proxy_l *prox
13331333
tm_has_request_disponsition_no_cancel(p_msg)==0 )
13341334
t->flags|=T_MULTI_200OK_FLAG;
13351335

1336-
/* update the transaction only if in REQUEST route; for other types
1337-
of routes we do not want to inherit the local changes */
1338-
if (route_type==REQUEST_ROUTE)
1339-
update_cloned_msg_from_msg( t->uas.request, p_msg);
1340-
13411336
if (route_type==FAILURE_ROUTE) {
13421337
/* If called from failure route we need reset the branch counter to
13431338
* ignore the previous set of branches (already terminated) */
@@ -1347,6 +1342,12 @@ static int w_t_relay( struct sip_msg *p_msg , void *flags, struct proxy_l *prox
13471342
* created, better lock here to avoid any overlapping with
13481343
* branch injection from other processes */
13491344
LOCK_REPLIES(t);
1345+
1346+
/* update the transaction only if in REQUEST route; for other types
1347+
of routes we do not want to inherit the local changes */
1348+
if (route_type==REQUEST_ROUTE)
1349+
update_cloned_msg_from_msg( t->uas.request, p_msg);
1350+
13501351
ret = t_forward_nonack( t, p_msg, p, 1/*reset*/,1/*locked*/);
13511352
UNLOCK_REPLIES(t);
13521353
}

0 commit comments

Comments
 (0)