Skip to content

Conversation

bas-archembedded
Copy link
Contributor

When fs_stat() queries the root / mountpoint it should return its root i_node but instead it tries to return the parent i_node which does not exist. Fix this by checking if parent is set otherwise return the root i_node.

@de-nordic
Copy link
Contributor

We need bug report for the issue and will have to generate backport. @bas-archembedded Can you log Zephyr issue for the problem you have found and reference it here as being fixed/

@de-nordic
Copy link
Contributor

FYI @fzdobylak

@bas-archembedded
Copy link
Contributor Author

We need bug report for the issue and will have to generate backport. @bas-archembedded Can you log Zephyr issue for the problem you have found and reference it here as being fixed/

Opened issue in #94000

@bas-archembedded
Copy link
Contributor Author

FYI @fzdobylak
@de-nordic Not sure he will respond on this github account. It seems @fzdobylak changed jobs and does not work for AntMicro anymore and his activity on this account seems also not a lot this year.

@de-nordic
Copy link
Contributor

FYI @fzdobylak
@de-nordic Not sure he will respond on this github account. It seems @fzdobylak changed jobs and does not work for AntMicro anymore and his activity on this account seems also not a lot this year.

ok then. @fkokosinski FYI.

Copy link
Contributor

@de-nordic de-nordic left a comment

Choose a reason for hiding this comment

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

Looks OK.

@de-nordic de-nordic added backport v3.7-branch Request backport to the v3.7-branch backport v4.1-branch Request backport to the v4.1-branch backport v4.2-branch Request backport to the v4.2-branch labels Aug 6, 2025
@de-nordic de-nordic added this to the v4.3.0 milestone Aug 6, 2025
@de-nordic
Copy link
Contributor

@bas-archembedded One more thing: can you reference the bug fixed in commit message? Add the "Fixes #94000" line please.

@bas-archembedded
Copy link
Contributor Author

bas-archembedded commented Aug 6, 2025

@de-nordic Shall I add the extra __ASSERT check as @cfriedt suggested, to be extra safe ?

@de-nordic
Copy link
Contributor

@de-nordic Shall I add the extra __ASSERT check as @cfriedt suggested, to be extra safe ?

You mean when we get args.parrent == NULL? NULL topples the device over, __ASSERT will do the same (I know that it has to be specifically compiled int...)
If it is possible, somehow, to get the NULL here I would rather return error code and refuse to work.
I am not sure failed fs_stat should bring the device down in any scenario.

When fs_stat() queries the root / mountpoint it should return its root
i_node but instead it tries to return the parent i_node which does not
exist. Fix this by checking if parent is set otherwise return the root
i_node.

Fixes zephyrproject-rtos#94000.

Signed-off-by: Bas van Loon <[email protected]>
@bas-archembedded
Copy link
Contributor Author

@bas-archembedded One more thing: can you reference the bug fixed in commit message? Add the "Fixes #94000" line please.

@de-nordic Shall I add the extra __ASSERT check as @cfriedt suggested, to be extra safe ?

You mean when we get args.parrent == NULL? NULL topples the device over, __ASSERT will do the same (I know that it has to be specifically compiled int...) If it is possible, somehow, to get the NULL here I would rather return error code and refuse to work. I am not sure failed fs_stat should bring the device down in any scenario.

I will keep it as is, "Fixes" line added.

Copy link

sonarqubecloud bot commented Aug 6, 2025

@de-nordic de-nordic linked an issue Aug 8, 2025 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: File System backport v3.7-branch Request backport to the v3.7-branch backport v4.1-branch Request backport to the v4.1-branch backport v4.2-branch Request backport to the v4.2-branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EXT2 fs_stat on mount point fails with a NULL pointer dereference.
4 participants