Thanks to visit codestin.com
Credit goes to github.com

Skip to content

LittleFileSystem2 crashes in unmount in some scenarios #1042

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

Open
schnoberts1 opened this issue Mar 26, 2025 · 2 comments · May be fixed by #1059
Open

LittleFileSystem2 crashes in unmount in some scenarios #1042

schnoberts1 opened this issue Mar 26, 2025 · 2 comments · May be fixed by #1059

Comments

@schnoberts1
Copy link

Consider:

 auto& userPartition { qspi.userPartition() }; // This returns a reference to a block device.
 LittleFileSystem2 userFilesystem( "user" );
 auto err = userFilesystem.reformat( &userPartition );

This crashes (depending on where it is in the code base) because reformat calls unmount. Unmount checks whether userFilesystem._bd is null and if not tries to deinit() it. Sadly the constructor for LittleFileSystem2 does not initialise _bd so it's whatever is lying around. LittleFileSystem doesn't have this issue as it initialises its fields properly.

I know this is a dead ARM port that the core just uses, but I spent an hour tracking it down so I thought I'd log it for others to find.

@multiplemonomials
Copy link

Hi! Nice find on this, I created a PR to fix this bug on Mbed Community Edition! mbed-ce/mbed-os#451

@pennam pennam linked a pull request May 5, 2025 that will close this issue
@pennam
Copy link
Contributor

pennam commented May 5, 2025

Thanks @multiplemonomials. I've opened a PR to include your fix in the next core release

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 a pull request may close this issue.

3 participants