Skip to content

fs: fix and deduplicate whence handling in default_llseek()

Siddharth Chintamaneni linux-fsdevel lkml 1 version Applied

Status from this message: Applied to the vfs.fixes branch of the vfs/vfs.git tree.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2fs: reject negative offsets for SEEK_DATA and SEEK_HOLE in default_llseek()fs/read_write.c+6 -40 replies
2/2fs: use must_set_pos() in default_llseek()fs/read_write.c+14 -360 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJan Kara
SeriesR-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

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

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

Signature · 1 line
2.50.1 (Apple Git-155)