Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: LPC43x0 Flash detection failure mishandling #1562

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

dragonmux
Copy link
Member

Detailed description

This PR address a bug in the LPC43x0 support found via ASAN in which when Flash detection fails, the Flash structure is never allocated.

This leads to lpc43x0_detach() trying to dereference a NULL pointer in priv->flashand so crash. Checking for the possible NULL pointer and guarding the whole Flash structure freeing operation avoids this.

Your checklist for this pull request

  • I've read the Code of Conduct
  • I've read the guidelines for contributing to this repository
  • It builds for hardware native (make PROBE_HOST=native)
  • It builds as BMDA (make PROBE_HOST=hosted)
  • I've tested it to the best of my ability
  • My commit messages provide a useful short description of what the commits do

Closing issues

@dragonmux dragonmux requested a review from esden July 23, 2023 21:47
@dragonmux dragonmux added this to the v1.10 milestone Jul 23, 2023
@dragonmux dragonmux added the Bug Confirmed bug label Jul 23, 2023
@dragonmux dragonmux changed the title lpc43xx: Fixed a bug in lpc43x0_detach() which leads to a crash via NULL dereference when Flash detection fails Fix: LPC43x0 Flash detection failure mishandling Jul 23, 2023
Copy link
Member

@esden esden left a comment

Choose a reason for hiding this comment

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

LGTM

@esden esden merged commit 2677a24 into main Jul 26, 2023
6 checks passed
@dragonmux dragonmux deleted the fix/lpc43x0-flash-detection-failure-mishandling branch July 26, 2023 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants