Skip to content

bugfix: events: stop processing scan results when aborting#136

Open
fvb-verhaert wants to merge 1 commit into
zephyrproject-rtos:mainfrom
copilotone-verhaert:bugfix/fix_infinite_scan_loop_issue
Open

bugfix: events: stop processing scan results when aborting#136
fvb-verhaert wants to merge 1 commit into
zephyrproject-rtos:mainfrom
copilotone-verhaert:bugfix/fix_infinite_scan_loop_issue

Conversation

@fvb-verhaert

Copy link
Copy Markdown

In our testing of the Wi-Fi stack, we came across a scenario where when attempting to connect to a non-existing Wi-Fi network and then calling wifi disconnect, the stack gets stuck in an infinite loop where it's continually trying to process the same scan results without end.
This one-line fix prevents that loop from happening by exiting the scan parsing early if we are aborting.

Steps to reproduce the original issue:

uart:~$ wifi connect -s nonexistent -p testtesttest -k 10
Connection requested
# Wait about 10 seconds
uart:~$ wifi disconnect
# deadlock

Note that this does not always reproduce the issue, it's somewhat timing dependent

Platform: NXP RW610

Signed-off-by: Frederik Van Bogaert <frederik.vanbogaert@mind.be>

@krish2718 krish2718 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please add commit log with details of the issue and how/why the fix helps. And also submit this fix to the hostap mailing list, once its merged then it can be cherry-picked to Zephyr as fromtree

Copilot AI left a comment

Copy link
Copy Markdown

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 prevents scan result processing from continuing when a scan has been reported as aborted, avoiding a timing-dependent infinite loop/deadlock observed when disconnecting during a failed connection attempt (e.g., connecting to a nonexistent SSID and then issuing wifi disconnect).

Changes:

  • Treat aborted scans (data->scan_info.aborted) like update_only scans by short-circuiting scan result processing.
  • Ensure scan work is still completed and scan results are freed via the existing scan_work_done path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants