stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Mateusz S <muttdini@gmail.com>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Theodore Tso <tytso@mit.edu>
Subject: [PATCH 3.18 01/19] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
Date: Mon, 16 Oct 2017 18:11:52 +0200	[thread overview]
Message-ID: <20171016160922.091796644@linuxfoundation.org> (raw)
In-Reply-To: <20171016160922.020176454@linuxfoundation.org>

3.18-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Darrick J. Wong <darrick.wong@oracle.com>

commit 1bd8d6cd3e413d64e543ec3e69ff43e75a1cf1ea upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/file.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -399,7 +399,7 @@ static loff_t ext4_seek_data(struct file
 	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;
 	}
@@ -472,7 +472,7 @@ static loff_t ext4_seek_hole(struct file
 	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;
 	}

  reply	other threads:[~2017-10-16 16:12 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 16:11 [PATCH 3.18 00/19] 3.18.76-stable review Greg Kroah-Hartman
2017-10-16 16:11 ` Greg Kroah-Hartman [this message]
2017-10-16 16:11 ` [PATCH 3.18 02/19] CIFS: Reconnect expired SMB sessions Greg Kroah-Hartman
2017-10-16 16:11 ` [PATCH 3.18 03/19] HID: usbhid: fix out-of-bounds bug Greg Kroah-Hartman
2017-10-16 16:11 ` [PATCH 3.18 05/19] KVM: nVMX: fix guest CR4 loading when emulating L2 to L1 exit Greg Kroah-Hartman
2017-10-16 16:11 ` [PATCH 3.18 06/19] usb: renesas_usbhs: Fix DMAC sequence for receiving zero-length packet Greg Kroah-Hartman
2017-10-16 16:11 ` [PATCH 3.18 07/19] iommu/amd: Finish TLB flush in amd_iommu_unmap() Greg Kroah-Hartman
2017-10-16 16:11 ` [PATCH 3.18 08/19] ALSA: usb-audio: Kill stray URB at exiting Greg Kroah-Hartman
2017-10-16 18:50   ` Takashi Iwai
2017-10-17 14:07     ` Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 3.18 09/19] ALSA: seq: Fix use-after-free at creating a port Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 3.18 10/19] ALSA: seq: Fix copy_from_user() call inside lock Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 3.18 11/19] ALSA: caiaq: Fix stray URB at probe error path Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 3.18 12/19] usb: gadget: composite: Fix use-after-free in usb_composite_overwrite_options Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 3.18 13/19] direct-io: Prevent NULL pointer access in submit_page_section Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 3.18 14/19] fix unbalanced page refcounting in bio_map_user_iov Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 3.18 15/19] USB: serial: cp210x: add support for ELV TFD500 Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 3.18 16/19] USB: serial: option: add support for TP-Link LTE module Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 3.18 17/19] USB: serial: qcserial: add Dell DW5818, DW5819 Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 3.18 18/19] USB: serial: console: fix use-after-free after failed setup Greg Kroah-Hartman
2017-10-16 16:12 ` [PATCH 3.18 19/19] ALSA: seq: Fix missing NULL check at remove_events ioctl Greg Kroah-Hartman
2017-10-16 23:42 ` [PATCH 3.18 00/19] 3.18.76-stable review Shuah Khan
2017-10-17  0:23 ` Guenter Roeck
     [not found] ` <59e53ebe.532f1c0a.7d93d.9f31@mx.google.com>
2017-10-17 13:22   ` Greg Kroah-Hartman
2017-10-19 12:21     ` Kevin Hilman
2017-10-19 13:45       ` Guillaume Tucker
2017-10-17 14:40 ` Greg Kroah-Hartman
2017-10-17 18:12   ` Shuah Khan
2017-10-18  7:09     ` Greg Kroah-Hartman
     [not found]   ` <CALpmF+Fgzn6mzp_ReEfcQ7t=LvSTK5uDP_jftV_Cf1dBf1h0wQ@mail.gmail.com>
2017-10-18  7:09     ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171016160922.091796644@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=darrick.wong@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muttdini@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).