* [PATCH] [RESEND] vfs: Return -ENXIO for negative SEEK_HOLE / SEEK_DATA llseek offsets
@ 2017-09-14 14:29 Andreas Gruenbacher
0 siblings, 0 replies; only message in thread
From: Andreas Gruenbacher @ 2017-09-14 14:29 UTC (permalink / raw)
To: Alexander Viro; +Cc: Andreas Gruenbacher, linux-fsdevel, stable
This patch was first posted on August 30, and hasn't shown up in
mainline or vfs/for-next so far. Please apply.
Thanks,
Andreas
--
In generic_file_llseek_size, return -ENXIO for negative offsets as well
as offsets beyond EOF. This affects filesystems which don't implement
SEEK_HOLE / SEEK_DATA themselves, possibly because they don't support
holes.
Fixes xfstest generic/448.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Cc: stable@vger.kernel.org
---
fs/read_write.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/read_write.c b/fs/read_write.c
index 61b58c7b6531..581f3516e99f 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -112,7 +112,7 @@ generic_file_llseek_size(struct file *file, loff_t offset, int whence,
* In the generic case the entire file is data, so as long as
* offset isn't at the end of the file then the offset is data.
*/
- if (offset >= eof)
+ if ((unsigned long long)offset >= eof)
return -ENXIO;
break;
case SEEK_HOLE:
@@ -120,7 +120,7 @@ generic_file_llseek_size(struct file *file, loff_t offset, int whence,
* There is a virtual hole at the end of the file, so as long as
* offset isn't i_size or larger, return i_size.
*/
- if (offset >= eof)
+ if ((unsigned long long)offset >= eof)
return -ENXIO;
offset = eof;
break;
--
2.13.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-09-14 14:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-14 14:29 [PATCH] [RESEND] vfs: Return -ENXIO for negative SEEK_HOLE / SEEK_DATA llseek offsets Andreas Gruenbacher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).