Skip to content

Commit

Permalink
Fix crash on building CANCEL requests.
Browse files Browse the repository at this point in the history
Avoid the race condition between building a local cancel and handling a negative reply (for the same branch, in different processes). The build_local mya use the temporary uac->reply and end up with a dnagling pointer. Anyhow, in CANCEL situation, you never have a stored reply in transaction (storing is done only during parallel forking for nagative branches - which are not to be cancelled anyhow).

(cherry picked from commit 156fba8)
  • Loading branch information
bogdan-iancu committed May 7, 2015
1 parent 20f6b13 commit e5ab624
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/tm/t_cancel.c
Expand Up @@ -135,7 +135,11 @@ char *build_cancel(struct cell *Trans,unsigned int branch,
extra = &_extra_cancel_hdrs;
}
return build_local( Trans, branch, &method, extra,
Trans->uac[branch].reply , len );
NULL /*reply*/ , len );
/* ^^^^ when CANCELing, there are 0 chances to have a reply stored into
* transaction ; set it NULL to avoid using the temporary stored reply
* (by t_should_relay_response) which may lead into races ( building the
* cancel versus handling a final response in a different process )*/
}


0 comments on commit e5ab624

Please sign in to comment.