Go to file
Simon Tatham 397e6aa03f affs: don't write overlarge OFS data block size fields
[ Upstream commit 011ea742a2 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-04-10 14:32:03 +02:00
arch x86/dumpstack: Fix inaccurate unwinding from exception stacks due to misplaced assignment 2025-04-10 14:32:01 +02:00
block
certs
crypto
Documentation
drivers nvme-pci: skip CMB blocks incompatible with PCI P2P DMA 2025-04-10 14:32:03 +02:00
fs affs: don't write overlarge OFS data block size fields 2025-04-10 14:32:03 +02:00
include sched/smt: Always inline sched_smt_active() 2025-04-10 14:32:03 +02:00
init
io_uring
ipc
kernel ring-buffer: Fix bytes_dropped calculation issue 2025-04-10 14:32:02 +02:00
lib
LICENSES
mm
net rtnetlink: Allocate vfinfo size for VF GUIDs when supported 2025-04-10 14:32:02 +02:00
samples
scripts
security
sound
tools perf python: Check if there is space to copy all the event 2025-04-10 14:32:02 +02:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.