From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:39390 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751455AbdJLLiG (ORCPT ); Thu, 12 Oct 2017 07:38:06 -0400 Date: Thu, 12 Oct 2017 13:38:13 +0200 From: Greg KH To: Theodore Ts'o Cc: stable@vger.kernel.org Subject: Re: [FOR STABLE] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets Message-ID: <20171012113813.GA32149@kroah.com> References: <20171008040632.5by5r5seyajwdp3z@thunk.org> <20171010181049.GI747@kroah.com> <20171010214425.42e6voatru2fowft@thunk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171010214425.42e6voatru2fowft@thunk.org> Sender: stable-owner@vger.kernel.org List-ID: 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" > 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 > Signed-off-by: Darrick J. Wong > Signed-off-by: Theodore Ts'o > 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