* [PATCH] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
@ 2017-07-12 17:32 Darrick J. Wong
2017-08-24 17:27 ` Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2017-07-12 17:32 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: linux-ext4, Mateusz S
NOTE: The pending iomap SEEK_HOLE/DATA conversion patch will make all this
obsolete; this is a fix more appropriate for pre-4.13 ext4.
---
In the ext4 implementations of SEEK_HOLE and SEEK_DATA, make sure we
return -ENXIO for negative offsets instead of banging around inside
the extent code and returning -EFSCORRUPTED.
Reported-by: Mateusz S <muttdini@gmail.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/ext4/file.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 02ce7e7..923e765 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -576,7 +576,7 @@ static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
inode_lock(inode);
isize = i_size_read(inode);
- if (offset >= isize) {
+ if (offset < 0 || offset >= isize) {
inode_unlock(inode);
return -ENXIO;
}
@@ -639,7 +639,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
inode_lock(inode);
isize = i_size_read(inode);
- if (offset >= isize) {
+ if (offset < 0 || offset >= isize) {
inode_unlock(inode);
return -ENXIO;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
2017-07-12 17:32 [PATCH] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets Darrick J. Wong
@ 2017-08-24 17:27 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2017-08-24 17:27 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-ext4, Mateusz S
On Wed, Jul 12, 2017 at 10:32:32AM -0700, Darrick J. Wong wrote:
> NOTE: The pending iomap SEEK_HOLE/DATA conversion patch will make all this
> obsolete; this is a fix more appropriate for pre-4.13 ext4.
> ---
> In the ext4 implementations of SEEK_HOLE and SEEK_DATA, make sure we
> return -ENXIO for negative offsets instead of banging around inside
> the extent code and returning -EFSCORRUPTED.
>
> Reported-by: Mateusz S <muttdini@gmail.com>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Sorry, I missed this patch earlier. It's not going to make the 4.13
final, but I'll apply it with a "cc: stable@vger.kernel.org # 4.6" tag
so it can land in 4.13.x as well as older LTS kernels.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-24 17:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-12 17:32 [PATCH] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets Darrick J. Wong
2017-08-24 17:27 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox