Skip to content

Conversation

@nanangizz
Copy link
Member

Consider scenario:

  1. Remove port 5.
  2. Before port 5 is really removed, disconnect port 4->5.
  3. Port 5 is removed.
  4. When executing the disconnect 4->5, port 5 is now NULL, it incorrectly executes it as disconnect 4->*.

Thanks to Sean Riley for the report.

This PR addresses the issue in two places:

  • Disconnect execution: add a double check to ensure the specified port is valid before proceeding.
  • Prevention: introduce a 'removing' flag on ports to prevent connect/disconnect/configure operations from being queued while the port is pending removal.

Consider scenario:
1. Remove port 5.
2. Before port 5 is really removed, disconnect port 4->5.
3. Port 5 is removed.
4. When executing the disconnect 4->5, port 5 is now `NULL`, instead of ignoring the operation, it incorrectly executes it as disconnect 4->*.

This PR addresses the issue in two places:
- Disconnect execution: add a double check to ensure the specified port is valid before proceeding.
- Prevention: introduce a 'removing' flag on ports to prevent connect/disconnect/configure operations from being queued while the port is pending removal.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a race condition in the PJMEDIA conference bridge where a disconnect operation on a port being removed could be executed incorrectly. Specifically, if a port is queued for removal and a disconnect operation is queued before the removal completes, the disconnect could execute after the port becomes NULL, causing it to be interpreted as a wildcard disconnect (e.g., disconnect 4->* instead of 4->5).

The fix implements a two-pronged approach:

  • Prevention: Introduces a removing flag on conference ports that prevents new connect/disconnect/configure operations from being queued while a port is pending removal
  • Validation: Adds double-checks in op_disconnect_ports to verify ports are still valid when the operation executes

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants