Skip to content

fix(ping): Ensure race condition does not cause crash if ping succeeds quickly#650

Merged
finger563 merged 1 commit into
mainfrom
fix/ping
Jun 25, 2026
Merged

fix(ping): Ensure race condition does not cause crash if ping succeeds quickly#650
finger563 merged 1 commit into
mainfrom
fix/ping

Conversation

@finger563

Copy link
Copy Markdown
Contributor

Description

  • Fix (ping component): Ping::handle_end() deleted the session from inside the esp_ping thread's on_end callback, after notify_all() — a use-after-free of the Ping object once a run_sync() caller woke and destroyed it (crash on
    ping success). notify_all() is now the last statement in handle_end(), and the session is deleted from the caller's context in run_sync().

Motivation and Context

Ensures ping sessions which complete quickly / successfully do not crash the application due to a use-after-free of the Ping object.

How has this been tested?

Built and run as part of the esp32-p4 ev board change #649

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

@finger563 finger563 self-assigned this Jun 25, 2026
@finger563 finger563 added bug Something isn't working ping labels Jun 25, 2026
@github-actions

Copy link
Copy Markdown

✅Static analysis result - no issues found! ✅

@finger563 finger563 merged commit 8590a22 into main Jun 25, 2026
116 checks passed
@finger563 finger563 deleted the fix/ping branch June 25, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant