1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/fs/affs
Simon Tatham 011ea742a2 affs: don't write overlarge OFS data block size fields
If a data sector on an OFS floppy contains a value > 0x1e8 (the
largest amount of data that fits in the sector after its header), then
an Amiga reading the file can return corrupt data, by taking the
overlarge size at its word and reading past the end of the buffer it
read the disk sector into!

The cause: when affs_write_end_ofs() writes data to an OFS filesystem,
the new size field for a data block was computed by adding the amount
of data currently being written (into the block) to the existing value
of the size field. This is correct if you're extending the file at the
end, but if you seek backwards in the file and overwrite _existing_
data, it can lead to the size field being larger than the maximum
legal value.

This commit changes the calculation so that it sets the size field to
the max of its previous size and the position within the block that we
just wrote up to.

Signed-off-by: Simon Tatham <anakin@pobox.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-02-26 15:20:57 +01:00
..
affs.h affs: Remove unused macros GET_END_PTR, AFFS_GET_HASHENTRY 2024-09-06 17:48:14 +02:00
amigaffs.c affs: convert to new timestamp accessors 2023-10-18 13:26:18 +02:00
amigaffs.h affs: Replace one-element array with flexible-array member 2024-09-06 17:48:15 +02:00
bitmap.c Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
Changes remove obsolete references to powertweak 2013-11-27 20:34:32 -08:00
dir.c affs: store cookie in private data 2024-09-09 11:58:08 +02:00
file.c affs: don't write overlarge OFS data block size fields 2025-02-26 15:20:57 +01:00
inode.c affs: convert to new timestamp accessors 2023-10-18 13:26:18 +02:00
Kconfig fs: add CONFIG_BUFFER_HEAD 2023-08-02 09:13:09 -06:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
namei.c affs: d_obtain_alias(ERR_PTR(...)) will do the right thing 2023-12-21 12:51:02 -05:00
super.c affs: convert affs to use the new mount api 2024-09-18 11:44:43 +02:00
symlink.c affs: convert affs_symlink_read_folio() to use the folio 2023-08-18 10:12:29 -07:00