[Asterisk-code-review] chan_dahdi: set CHANNEL(hangupsource) when a PRI channel hangs up (...asterisk[16])

Richard Mudgett asteriskteam at digium.com
Thu Sep 5 11:43:38 CDT 2019


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/12846 )

Change subject: chan_dahdi: set CHANNEL(hangupsource) when a PRI channel hangs up
......................................................................


Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/12846/1/channels/sig_pri.c 
File channels/sig_pri.c:

https://gerrit.asterisk.org/#/c/12846/1/channels/sig_pri.c@1397 
PS1, Line 1397: 
              : 	sig_pri_lock_owner(pri, chanpos);
              : 	if (pri->pvts[chanpos]->owner) {
              : 		ast_queue_hangup(pri->pvts[chanpos]->owner);
              : 		ast_channel_unlock(pri->pvts[chanpos]->owner);
              : 	}
              : 
              : 	/* Tell the CDR this DAHDI channel hung up */
              : 	if(pri->pvts[chanpos]->owner) {
              : 		ast_set_hangupsource(pri->pvts[chanpos]->owner, ast_channel_name(pri->pvts[chanpos]->owner), 0);
              : 	}
This patch creates a deadlock potential between the already held sig_pri_lock_private() and attempting to get the owner channel lock.  The locking order is channel before private lock.

Should change to:

struct ast_channel *owner;

sig_pri_lock_owner(pri, chanpos);
owner = pri->pvts[chanpos]->owner;
if (owner) {
   ao2_ref(owner, +1);
   ast_queue_hangup(owner);
   ast_channel_unlock(owner);

   /* Tell the CDR this DAHDI channel hung up */
   sig_pri_unlock_private(pri->pvts[chanpos]);
   ast_set_hangup_source(owner, ast_channel_name(owner));
   sig_pri_lock_private(pri->pvts[chanpos]);
   ao2_ref(owner, -1);
}



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/12846
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I0f588a4bcf15ccd0648fd69830d1b801c3f21b7c
Gerrit-Change-Number: 12846
Gerrit-PatchSet: 1
Gerrit-Owner: Frederic LE FOLL <frederic.lefoll at c-s.fr>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Thu, 05 Sep 2019 16:43:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190905/35cfaee9/attachment.html>


More information about the asterisk-code-review mailing list