Summary:ASTERISK-24740: [patch]Segmentation fault on aoc-e event
Reporter:Panos Gkikakis (roeften)Labels:
Date Opened:2015-01-30 13:31:00.000-0600Date Closed:2015-02-19 12:27:13.000-0600
Versions:12.4.0 13.1.0 13.1.1 Frequency of
is related toASTERISK-22670 Asterisk crashes when processing ISDN AoC Events
is related toASTERISK-24689 Segfault on hangup after outgoing PRI-Euroisdn call
Environment:Centos 7 kernel 3.10.0-123.13.2.el7.x86_64, Asterisk 13.1.0, DAHDI, libpri 1.4.15, B410 quad-BRI, Telco provides BRI.Attachments:( 0) fix-2.diff
Description:When the remote end of a call is a DAHDI channel and hangups first, if an AOC-E message is received, a segmentation fault occurs. I have traced the problem to the manager event being generated (from cache) for a channel that does not exist. A patch will be provided to resolve the immediate issue (seg fault).
Comments:By: Panos Gkikakis (roeften) 2015-01-30 13:32:22.630-0600

Fix for the issue.

Function ast_channel_publish_cached_blob now handles correctly a null channel like when a DAHDI channel is destroyed before receiving the AOC-E message.

The ast_channel_uniqueid function in main/channel_internal_api.c however will still return inconsistent data when provided with a null channel.

By: Matt Jordan (mjordan) 2015-01-30 16:27:56.947-0600

I don't think that's the right fix for the issue. Altering the code in {{stasis_channel}} affects all producers of information. If a producer is calling {{ast_channel_publish_cached_blob}}, then they should get a cached channel snapshot. If one is not available - that is, if the channel was already NULL - then they should have called {{ast_channel_publish_blob}}, which is NULL tolerant.

This is a problem in the code that is publishing the message, and not in {{stasis_channel}}.

By: Panos Gkikakis (roeften) 2015-01-30 16:41:17.875-0600

Moved location of the fix to aoc manager event code instead of the stasis channel.

By: Rusty Newton (rnewton) 2015-02-03 17:54:04.216-0600

Panos, the next step is to make sure your patch gets on Review board. See the Patch Contribution Process.

Once you get it on there, please add the Reviewboard URL link to this issue.

By: Birger "WIMPy" Harzenetter (wimpy) 2015-02-06 18:07:44.940-0600

Just a precaution:
This should probably also be tested with AOC-E messages not associated with a call.

By: Marcel Manz (simmcomm) 2015-02-09 15:39:34.334-0600

I have tested the patch and can confirm that Asterisk is no longer crashing when receiving such events. I however have only tested our particular use case (AOC-E messages associated with an outbound call).

By: Panos Gkikakis (roeften) 2015-02-15 16:39:48.509-0600

I have submitted a single patch for all related issues, hope that's ok.

By: Richard Mudgett (rmudgett) 2015-02-17 11:55:04.518-0600

I have created a new patch on reviewboard: https://reviewboard.asterisk.org/r/4430/