Re: [PATCH v1 0/2] fs: fix and deduplicate whence handling in default_llseek()
From: Jan Kara
Date: Thu Nov 05 2026 - 06:32:59 EST
On Sat 31-10-26 23:00:47, Siddharth Chintamaneni wrote:
> 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()
Looks good! Feel free to add:
Reviewed-by: Jan Kara <jack@xxxxxxx>
Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR