Skip to content

LittleFileSystem2 crashes in unmount in some scenarios #1042

Open
@schnoberts1

Description

@schnoberts1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions