[PATCH v3 00/10] ext4: Overflow fixes

Simon Glass sjg at chromium.org
Sat May 10 15:06:06 CEST 2025


This series fixes some potential overflows in the ext4 code with invalid
or malicious filesystems.

To assist with this and future work, it brings in overflow.h and part of
limits.h from Linux.

Changes in v3:
- Split out into separate patches for easier review

Changes in v2:
- Add new patch to bring in linux/limits.h
- Add new patch to bring in linux/overflow.h
- Use Linux macros instead of gcc built-ins

Simon Glass (10):
  Bring in linux/limits.h
  Bring in linux/overflow.h
  ext4: Avoid expr in declaration in ext4fs_get_bgdtable()
  ext4: Create a var for the number of blocks to allocate
  ext4: Check for overflow of block count
  ext4: Bail out of no_blk_pergdt() if there are no blocks
  ext4: Replace multiplication with an existing variable
  ext4: Set a max limit on block-size in ext4fs_init()
  ext4: Make sure there is at least one sector per block
  ext4: Check for overflow when allocating tables

 fs/ext4/ext4_write.c     |  25 ++-
 include/limits.h         |   2 +
 include/linux/kernel.h   |  12 --
 include/linux/limits.h   |  21 ++
 include/linux/overflow.h | 443 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 487 insertions(+), 16 deletions(-)
 create mode 100644 include/linux/limits.h
 create mode 100644 include/linux/overflow.h

-- 
2.43.0

base-commit: c5a631df96de7421d10ee03dceed1b79db213026
branch: sec3


More information about the U-Boot mailing list