<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/20036">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_console: Fix deadlock when reading audio.<br><br>When calling a console channel, chan_console will<br>deadlock due to the console pivot lock being held<br>persistently. This is due to holding it locked during<br>Pa_ReadStream, which is a blocking call.<br><br>This adjusts the locking order to resolve the deadlock<br>and allow console channels to function normally.<br><br>Reported-by: Sebastian Gutierrez<br><br>ASTERISK-30481 #close<br><br>Change-Id: I2d936bdcd4bcf18ce2aeb3b7bdb5cd3589a6d6d8<br>---<br>M channels/chan_console.c<br>1 file changed, 25 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/36/20036/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/chan_console.c b/channels/chan_console.c</span><br><span>index 5189212..97be8c1 100644</span><br><span>--- a/channels/chan_console.c</span><br><span>+++ b/channels/chan_console.c</span><br><span>@@ -276,15 +276,17 @@</span><br><span> </span><br><span>     for (;;) {</span><br><span>           pthread_testcancel();</span><br><span style="color: hsl(0, 100%, 40%);">-           console_pvt_lock(pvt);</span><br><span>               res = Pa_ReadStream(pvt->stream, buf, sizeof(buf) / sizeof(int16_t));</span><br><span style="color: hsl(0, 100%, 40%);">-                console_pvt_unlock(pvt);</span><br><span>             pthread_testcancel();</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+             console_pvt_lock(pvt);</span><br><span>               if (!pvt->owner) {</span><br><span style="color: hsl(120, 100%, 40%);">+                 console_pvt_unlock(pvt);</span><br><span>                     return NULL;</span><br><span>                 }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+         console_pvt_unlock(pvt);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>           if (res == paNoError)</span><br><span>                        ast_queue_frame(pvt->owner, &f);</span><br><span>      }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/20036">change 20036</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/20036"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I2d936bdcd4bcf18ce2aeb3b7bdb5cd3589a6d6d8 </div>
<div style="display:none"> Gerrit-Change-Number: 20036 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>