[Home]

Summary:ASTERISK-16162: [patch] ss_thread calls pri_grab without lock during overlap dial
Reporter:Peter Fern (pdf)Labels:
Date Opened:2010-05-28 02:28:47Date Closed:2010-07-06 15:09:41
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_dahdi
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) bug17414.patch
Description:Recent changes to chan_dahdi with relation to overlap dialling call pri_grab without first obtaining a lock.  This is likely to result in lock leakage due to issue ASTERISK-1716407.
Comments:By: Paul Belanger (pabelanger) 2010-05-28 08:38:44

Are you able to provide a patch?

By: David Woolley (davidw) 2010-05-28 10:29:16

Surely the more serious point is that it tries to do:

p->proceeding = 1;

on a channel private structure that it erroneously thinks it owns (currently it deadlocks first, but some of the proposals for DEADLOCK_AVOIDANCE could make it actually do this.

(There are a lot of unlocked accesses to the private structure in that function, but I could provisionally assume that they are fields that are readonly once the structure has been created.)

I'm assuming we are talking about this fragment:

if (p->pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING) {
if (p->pri->pri) {
if (!pri_grab(p, p->pri)) {
pri_proceeding(p->pri->pri, p->call, PVT_TO_CHANNEL(p), 0);
p->proceeding = 1;
pri_rel(p->pri);
} else {
ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
}
}
}


in ss_thread()

I'm not into the internals of chan_dahdi, so I don't know what is safe to do unlocked, but here it is trying to gain control of a structure.

By: Jeff Peeler (jpeeler) 2010-06-04 13:55:42

Yeah the private should be locked before the pri lock, which the deadlock avoidance code expects.

By: Digium Subversion (svnbot) 2010-06-24 16:58:48

Repository: asterisk
Revision: 272446

U   branches/1.4/channels/chan_dahdi.c

------------------------------------------------------------------------
r272446 | rmudgett | 2010-06-24 16:58:48 -0500 (Thu, 24 Jun 2010) | 10 lines

ss_thread calls pri_grab without lock during overlap dial

Recent changes to chan_dahdi with relation to overlap dialing call
pri_grab without first obtaining a lock.

(closes issue ASTERISK-16162)
Reported by: pdf
Patches:
     bug17414.patch uploaded by jpeeler (license 325)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=272446

By: Digium Subversion (svnbot) 2010-06-24 17:11:26

Repository: asterisk
Revision: 272447

_U  trunk/
U   trunk/channels/sig_pri.c

------------------------------------------------------------------------
r272447 | rmudgett | 2010-06-24 17:11:25 -0500 (Thu, 24 Jun 2010) | 17 lines

Merged revisions 272446 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r272446 | rmudgett | 2010-06-24 16:58:49 -0500 (Thu, 24 Jun 2010) | 10 lines
 
 ss_thread calls pri_grab without lock during overlap dial
 
 Recent changes to chan_dahdi with relation to overlap dialing call
 pri_grab without first obtaining a lock.
 
 (closes issue ASTERISK-16162)
 Reported by: pdf
 Patches:
       bug17414.patch uploaded by jpeeler (license 325)
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=272447

By: Digium Subversion (svnbot) 2010-06-24 17:19:35

Repository: asterisk
Revision: 272459

_U  branches/1.6.2/
U   branches/1.6.2/channels/chan_dahdi.c

------------------------------------------------------------------------
r272459 | rmudgett | 2010-06-24 17:19:35 -0500 (Thu, 24 Jun 2010) | 24 lines

Merged revisions 272447 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r272447 | rmudgett | 2010-06-24 17:11:26 -0500 (Thu, 24 Jun 2010) | 17 lines
 
 Merged revisions 272446 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r272446 | rmudgett | 2010-06-24 16:58:49 -0500 (Thu, 24 Jun 2010) | 10 lines
   
   ss_thread calls pri_grab without lock during overlap dial
   
   Recent changes to chan_dahdi with relation to overlap dialing call
   pri_grab without first obtaining a lock.
   
   (closes issue ASTERISK-16162)
   Reported by: pdf
   Patches:
         bug17414.patch uploaded by jpeeler (license 325)
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=272459