Skip to content

[Backport v4.3-branch] fs: ext2: reject superblock with zero group divisors#110884

Open
github-actions[bot] wants to merge 1 commit into
v4.3-branchfrom
backport-107929-to-v4.3-branch
Open

[Backport v4.3-branch] fs: ext2: reject superblock with zero group divisors#110884
github-actions[bot] wants to merge 1 commit into
v4.3-branchfrom
backport-107929-to-v4.3-branch

Conversation

@github-actions

@github-actions github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

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:

  • 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.

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)
@github-actions github-actions Bot added the Backport Backport PR and backport failure issues label Jun 9, 2026
@github-project-automation github-project-automation Bot moved this to To do in Backports Jun 9, 2026
@jhedberg jhedberg closed this Jun 10, 2026
@github-project-automation github-project-automation Bot moved this from To do to Done in Backports Jun 10, 2026
@jhedberg jhedberg reopened this Jun 10, 2026
@github-project-automation github-project-automation Bot moved this from Done to Needs more info in Backports Jun 10, 2026
@github-actions

Copy link
Copy Markdown
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:

Fixes #<issue_number>

For stable releases, all changes MUST have a reference to an issue or a published advisory documenting:

  • the issue being fixed
  • its severity/impact

See https://docs.zephyrproject.org/latest/project/release_process.html#issue-tracking-during-feature-freeze for more details.

@jhedberg jhedberg moved this from Needs more info to Needs a bug report in Backports Jun 10, 2026
@cfriedt

cfriedt commented Jun 10, 2026

Copy link
Copy Markdown
Member

@ceolin - can you make an issue for this backport?

@sonarqubecloud

Copy link
Copy Markdown

@dkalowsk dkalowsk added this to the v4.3.1 milestone Jun 11, 2026
@jhedberg jhedberg modified the milestones: v4.3.1, v4.3.2 Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: File System Backport Backport PR and backport failure issues

Projects

Status: Needs a bug report

Development

Successfully merging this pull request may close these issues.

6 participants