summaryrefslogtreecommitdiff
path: root/include/linux/bnge/git@git.tavy.me:linux.git
diff options
context:
space:
mode:
authorViacheslav Dubeyko <slava@dubeyko.com>2026-07-06 15:18:05 -0700
committerViacheslav Dubeyko <slava@dubeyko.com>2026-07-14 10:24:56 -0700
commitc6decf13bf900324041fc117199ac793fc883f14 (patch)
tree644f20f99b75f24d168e319464c1f3efe618e670 /include/linux/bnge/git@git.tavy.me:linux.git
parente2ea5cac61acfc11dad22f1d2d4bc71d56c52a20 (diff)
hfs: fix error code when writing beyond volume capacity
Likewise HFS+, HFS has the same issue of returning the -ENOSPC error code instead of -EFBIG in the case if there is the effort to write beyond 8TiB. The root cause is that hfs_fill_super() sets s_maxbytes as MAX_LFS_FILESIZE. VFS therefore considers the write position valid and calls into the filesystem. Because HFS does not support holes, cont_write_begin() zero-fills the entire intermediate range from the current end-of-file to the target offset. On a small test volume this exhausts free space long before any block-number overflow is detected, producing -ENOSPC instead of -EFBIG. This patch fixes the issue by adding a bounds check at the top of hfs_write_begin(). If the requested write position is at or beyond the actual capacity of the volume in bytes, return -EFBIG immediately before cont_write_begin() is entered and before any zero-fill I/O is attempted. cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> cc: Yangtao Li <frank.li@vivo.com> cc: linux-fsdevel@vger.kernel.org Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com> Link: https://lore.kernel.org/r/20260706221804.140295-2-slava@dubeyko.com Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
Diffstat (limited to 'include/linux/bnge/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions