omfs: reject writes starting beyond EOF
Subsystems (3)
PATCH 1/1 omfs: reject writes starting beyond EOF
OMFS does not initialize gaps between EOF and a buffered write. When the requested block lies beyond the allocated extents, omfs_get_block() grows the last extent and maps the write to the newly allocated block without accounting for the skipped logical blocks.
A one-byte pwrite() at offset 8192 into an empty file returns success, as does fsync(), but after remounting the byte is at offset 0 and offset 8192 reads as zero.
Reject writes starting beyond i_size before block_write_begin() can allocate or map buffers. Overwrites, appends and writes crossing EOF remain allowed. Gap initialization can be implemented separately.
--- fs/omfs/file.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/omfs/file.c +4 -0
@@ -317,6 +317,10 @@ static int omfs_write_begin(const struct kiocb *iocb, {int ret; +/* Initializing a gap between EOF and the write is not supported. */ +if (pos >i_size_read (mapping->host)) +return -EOPNOTSUPP ; + ret =block_write_begin (mapping, pos, len, foliop, omfs_get_block);if (unlikely (ret))omfs_write_failed (mapping, pos + len);
base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d
Signature · 1 line
2.50.1 (Apple Git-155)
Quoted 5 lines · Hungyu Lin
OMFS does not initialize gaps between EOF and a buffered write. When the requested block lies beyond the allocated extents,
omfs_get_block()grows the last extent and maps the write to the newly allocated block without accounting for the skipped logical blocks.
Quoted 7 lines
A one-byte
pwrite()at offset 8192 into an empty file returns success, as doesfsync(), but after remounting the byte is at offset 0 and offset 8192 reads as zero.Reject writes starting beyond
i_sizebeforeblock_write_begin()can allocate or map buffers. Overwrites, appends and writes crossing EOF remain allowed. Gap initialization can be implemented separately.
Why don't we just delete omfs?
This is the proprietary file system used by the Rio Karma music player and ReplayTV DVR
Rio Karma and ReplayTV were both EOL in 2005. Let's just delete this filesystem.