[Backport v4.3-branch] fs: ext2: reject superblock with zero group divisors#110884
Open
github-actions[bot] wants to merge 1 commit into
Open
[Backport v4.3-branch] fs: ext2: reject superblock with zero group divisors#110884github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
ext2_verify_disk_superblock() did not validate that the on-disk fields
s_blocks_per_group and s_inodes_per_group are non-zero. Both are later
used as divisors during mount-time initialization:
- get_ngroups() in subsys/fs/ext2/ext2_diskops.c divides and modulos
s_blocks_count by s_blocks_per_group when ext2_fetch_block_group()
runs from ext2_init_fs().
- get_itable_entry() in the same file divides (ino - 1) by
s_inodes_per_group when fetching the root inode during mount.
Reject both fields up front in the superblock validator so the mount
fails with -EINVAL before any block-group or inode I/O occurs.
Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
(cherry picked from commit babc090)
Author
|
This pull request to a release branch does not have an associated GitHub issue. Please update the pull request description to include a reference to the issue being fixed, for example: For stable releases, all changes MUST have a reference to an issue or a published advisory documenting:
See https://docs.zephyrproject.org/latest/project/release_process.html#issue-tracking-during-feature-freeze for more details. |
Member
|
@ceolin - can you make an issue for this backport? |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Backport babc090 from #107929.
Original PR description:
ext2_verify_disk_superblock() did not validate that the on-disk fields s_blocks_per_group and s_inodes_per_group are non-zero. Both are later used as divisors during mount-time initialization:
Reject both fields up front in the superblock validator so the mount fails with -EINVAL before any block-group or inode I/O occurs.