[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1514480352.304950901@decadent.org.uk>
Date: Thu, 28 Dec 2017 16:59:12 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org,
"Linus Torvalds" <torvalds@...ux-foundation.org>,
"Andreas Gruenbacher" <agruenba@...hat.com>
Subject: [PATCH 3.2 24/94] vfs: Return -ENXIO for negative SEEK_HOLE /
SEEK_DATA offsets
3.2.97-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <agruenba@...hat.com>
commit fc46820b27a2d9a46f7e90c9ceb4a64a1bc5fab8 upstream.
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 internally, possibly because they don't support
holes.
Fixes xfstest generic/448.
Signed-off-by: Andreas Gruenbacher <agruenba@...hat.com>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
[bwh: Backported to 3.2: s/eof/i_size_read(inode)/]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
fs/read_write.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -99,7 +99,7 @@ generic_file_llseek_size(struct file *fi
* 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 >= i_size_read(inode))
+ if ((unsigned long long)offset >= i_size_read(inode))
return -ENXIO;
break;
case SEEK_HOLE:
@@ -107,7 +107,7 @@ generic_file_llseek_size(struct file *fi
* 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 >= i_size_read(inode))
+ if ((unsigned long long)offset >= i_size_read(inode))
return -ENXIO;
offset = i_size_read(inode);
break;
Powered by blists - more mailing lists