]> git.ipfire.org Git - thirdparty/asterisk.git/commit
sig_analog: Fix channel leak when mwimonitor is enabled.
authorNaveen Albert <asterisk@phreaknet.org>
Fri, 24 Nov 2023 13:06:58 +0000 (08:06 -0500)
committerNaveen Albert <asterisk@phreaknet.org>
Tue, 28 Nov 2023 19:56:02 +0000 (19:56 +0000)
commit22e34193ee530144351d381ac00f1abc3f14f44f
tree7d4b298840039564582b9d7ee05c970baa9163f2
parent3859b630a75140def15e46729eaac2d3b00ce1a6
sig_analog: Fix channel leak when mwimonitor is enabled.

When mwimonitor=yes is enabled for an FXO port,
the do_monitor thread will launch mwi_thread if it thinks
there could be MWI on an FXO channel, due to the noise
threshold being satisfied. This, in turns, calls
analog_ss_thread_start in sig_analog. However, unlike
all other instances where __analog_ss_thread is called
in sig_analog, this call path does not properly set
pvt->ss_astchan to the Asterisk channel, which means
that the Asterisk channel is NULL when __analog_ss_thread
starts executing. As a result, the thread exits and the
channel is never properly cleaned up by calling ast_hangup.

This caused issues with do_monitor on incoming calls,
as it would think the channel was still owned even while
receiving events, leading to an infinite barrage of
warning messages; additionally, the channel would persist
improperly.

To fix this, the assignment is added to the call path
where it is missing (which is only used for mwi_thread).
A warning message is also added since previously there
was no indication that __analog_ss_thread was exiting
abnormally. This resolves both the channel leak and the
condition that led to the warning messages.

Resolves: #458
channels/sig_analog.c