[Asterisk-code-review] chan iax2: Prevent deadlock between hangup and sending lagrq... (asterisk[master])
Richard Mudgett
asteriskteam at digium.com
Thu May 14 19:27:54 CDT 2015
Richard Mudgett has posted comments on this change.
Change subject: chan_iax2: Prevent deadlock between hangup and sending lagrq/ping
......................................................................
Patch Set 11:
(2 comments)
https://gerrit.asterisk.org/#/c/169/11/channels/chan_iax2.c
File channels/chan_iax2.c:
Line 1706: /* Mark pingid as invalid scheduler id. */
: iaxs[callno]->pingid = -1;
> I understood that after send_ping return (and before __send_ping start to e
I've been going back and forth on setting pingid to -1 in send_ping() and in __send_ping().
Moving the setting of pingid to __send_ping() eliminates the locking in send_ping() and practically eliminates the deadlock problem in iax2_destroy_helper() and in make_trunk(). However, there is now the potential for DEV_MODE to assert on a stale id in make_trunk() when it attempts to delete the scheduled ping callback.
Leaving the setting of pingid in send_ping() keeps the deadlock potential in make_trunk() and with no assert potential on a stale pingid.
I think the iaxsl[] locking with make_trunk() to eliminate its deadlock potential needs to be explored.
Line 2076: if (ast_sched_find_data(sched, sched_id)) {
This check can fail if callno is zero. A simple way around the problem is to encode the send_ping/send_lagrq's data parameter as callno + 1 so data will never be NULL.
--
To view, visit https://gerrit.asterisk.org/169
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I03bec1fc8faacb89630269e935fa667c6d6c080c
Gerrit-PatchSet: 11
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Y Ateya <y.ateya at starkbits.com>
Gerrit-Reviewer: Ashley Sanders <asanders at digium.com>
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Y Ateya <y.ateya at starkbits.com>
Gerrit-HasComments: Yes
More information about the asterisk-code-review
mailing list