* [FOR STABLE] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
@ 2017-10-08 4:06 Theodore Ts'o
2017-10-10 18:10 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Theodore Ts'o @ 2017-10-08 4:06 UTC (permalink / raw)
To: stable
The upstream commit:
1bd8d6cd3e41: ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
has not landed in 4.9 yet, probably because it only recently hit
upstream (during the 4.14 merge window). The upstream commit will
automatically apply for 4.9 and newer kernels. However, it will not
cherry pick cleanly into the 3.18, 4.1, and 4.4 kernels. For the
stable kernels will need this adjusted backport.
- Ted
>From 7fa8b8b96e69f1ad1b2eb2ee107275e2d38a8769 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Thu, 24 Aug 2017 13:22:06 -0400
Subject: [PATCH] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
[ Upstream commit 1bd8d6cd3e413d64e543ec3e69ff43e75a1cf1ea ]
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>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org # 3.18
---
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 45ef9975caec..a8b1749d79a8 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -559,7 +559,7 @@ static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
mutex_lock(&inode->i_mutex);
isize = i_size_read(inode);
- if (offset >= isize) {
+ if (offset < 0 || offset >= isize) {
mutex_unlock(&inode->i_mutex);
return -ENXIO;
}
@@ -632,7 +632,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
mutex_lock(&inode->i_mutex);
isize = i_size_read(inode);
- if (offset >= isize) {
+ if (offset < 0 || offset >= isize) {
mutex_unlock(&inode->i_mutex);
return -ENXIO;
}
--
2.11.0.rc0.7.gbe5a750
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [FOR STABLE] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
2017-10-08 4:06 [FOR STABLE] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets Theodore Ts'o
@ 2017-10-10 18:10 ` Greg KH
2017-10-10 21:44 ` Theodore Ts'o
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2017-10-10 18:10 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: stable
On Sun, Oct 08, 2017 at 12:06:33AM -0400, Theodore Ts'o wrote:
> The upstream commit:
>
> 1bd8d6cd3e41: ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
>
> has not landed in 4.9 yet, probably because it only recently hit
> upstream (during the 4.14 merge window). The upstream commit will
> automatically apply for 4.9 and newer kernels.
No, it fails to apply to 4.9:
Applying patch ext4-in-ext4_seek_-hole-data-return-enxio-for-negative-offsets.patch
patching file fs/ext4/file.c
Hunk #1 succeeded at 590 (offset -5 lines).
Hunk #2 FAILED at 658.
1 out of 2 hunks FAILED -- rejects in file fs/ext4/file.c
Can you provide a backport?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FOR STABLE] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
2017-10-10 18:10 ` Greg KH
@ 2017-10-10 21:44 ` Theodore Ts'o
2017-10-12 11:38 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Theodore Ts'o @ 2017-10-10 21:44 UTC (permalink / raw)
To: Greg KH; +Cc: stable
On Tue, Oct 10, 2017 at 08:10:49PM +0200, Greg KH wrote:
> No, it fails to apply to 4.9:
>
> Applying patch ext4-in-ext4_seek_-hole-data-return-enxio-for-negative-offsets.patch
> patching file fs/ext4/file.c
> Hunk #1 succeeded at 590 (offset -5 lines).
> Hunk #2 FAILED at 658.
> 1 out of 2 hunks FAILED -- rejects in file fs/ext4/file.c
Here you go.
- Ted
>From 9bb648f3a9a41adac5d345b7a0c7308e17dbf3a9 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Thu, 24 Aug 2017 13:22:06 -0400
Subject: [PATCH] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative
offsets
[ Upstream commit 1bd8d6cd3e413d64e543ec3e69ff43e75a1cf1ea ]
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>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org # 4.6
---
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 d17d12ed6f73..510e66422f04 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -527,7 +527,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;
}
@@ -590,7 +590,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;
}
--
2.11.0.rc0.7.gbe5a750
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [FOR STABLE] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
2017-10-10 21:44 ` Theodore Ts'o
@ 2017-10-12 11:38 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2017-10-12 11:38 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: stable
On Tue, Oct 10, 2017 at 05:44:25PM -0400, Theodore Ts'o wrote:
> On Tue, Oct 10, 2017 at 08:10:49PM +0200, Greg KH wrote:
> > No, it fails to apply to 4.9:
> >
> > Applying patch ext4-in-ext4_seek_-hole-data-return-enxio-for-negative-offsets.patch
> > patching file fs/ext4/file.c
> > Hunk #1 succeeded at 590 (offset -5 lines).
> > Hunk #2 FAILED at 658.
> > 1 out of 2 hunks FAILED -- rejects in file fs/ext4/file.c
>
> Here you go.
>
> - Ted
>
> >From 9bb648f3a9a41adac5d345b7a0c7308e17dbf3a9 Mon Sep 17 00:00:00 2001
> From: "Darrick J. Wong" <darrick.wong@oracle.com>
> Date: Thu, 24 Aug 2017 13:22:06 -0400
> Subject: [PATCH] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative
> offsets
>
> [ Upstream commit 1bd8d6cd3e413d64e543ec3e69ff43e75a1cf1ea ]
>
> 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>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> Cc: stable@vger.kernel.org # 4.6
> ---
> 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 d17d12ed6f73..510e66422f04 100644
> --- a/fs/ext4/file.c
> +++ b/fs/ext4/file.c
> @@ -527,7 +527,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;
> }
> @@ -590,7 +590,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;
> }
That worked, thanks! All now applied.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-12 11:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-08 4:06 [FOR STABLE] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets Theodore Ts'o
2017-10-10 18:10 ` Greg KH
2017-10-10 21:44 ` Theodore Ts'o
2017-10-12 11:38 ` Greg KH
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).