[PATCH v1 0/2] fs: fix and deduplicate whence handling in default_llseek()

From: Siddharth Chintamaneni

Date: Sun Nov 01 2026 - 01:01:00 EST


This series fixes negative offset validation for SEEK_DATA and SEEK_HOLE
in default_llseek() and deduplicates its whence handling with
must_set_pos().

Patch 1 updates default_llseek() to read the inode size once via
i_size_read(inode) and compare (unsigned long long)offset >= eof for
SEEK_DATA and SEEK_HOLE so negative offsets fail with -ENXIO instead of
bypassing the range check.

Patch 2 replaces the open-coded switch (whence) block in
default_llseek() with a call to must_set_pos().

Siddharth Chintamaneni (2):
fs: reject negative offsets for SEEK_DATA and SEEK_HOLE in
default_llseek()
fs: use must_set_pos() in default_llseek()

fs/read_write.c | 48 ++++++++++++++----------------------------------
1 file changed, 14 insertions(+), 34 deletions(-)


base-commit: 36aad21d50d1af3f6954bb0c988257a908202477
--
2.50.1 (Apple Git-155)