All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: hch@infradead.org, bfoster@redhat.com
Cc: linux-xfs@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: [PATCH v2 5/7] iomap: warn on zero-length mappings
Date: Sat, 27 Jan 2018 10:08:55 -0800	[thread overview]
Message-ID: <20180127180855.GI9068@magnolia> (raw)
In-Reply-To: <151701544071.3070.9611886870612110372.stgit@magnolia>

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

Don't let the iomap callback get away with feeding us a garbage zero
length mapping -- there was a bug in xfs that resulted in those leaking
out to hilarious effect.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 fs/iomap.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/iomap.c b/fs/iomap.c
index e5de772..afd1635 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -65,6 +65,8 @@ iomap_apply(struct inode *inode, loff_t pos, loff_t length, unsigned flags,
 		return ret;
 	if (WARN_ON(iomap.offset > pos))
 		return -EIO;
+	if (WARN_ON(iomap.length == 0))
+		return -EIO;
 
 	/*
 	 * Cut down the length to the one actually provided by the filesystem,

  parent reply	other threads:[~2018-01-27 18:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-27  1:10 [PATCH v3 0/7] xfs: reflink/scrub/quota fixes Darrick J. Wong
2018-01-27  1:10 ` [PATCH 1/7] xfs: reflink should break pnfs leases before sharing blocks Darrick J. Wong
2018-01-27  7:31   ` Christoph Hellwig
2018-01-27  1:10 ` [PATCH 2/7] xfs: allow xfs_lock_two_inodes to take different EXCL/SHARED modes Darrick J. Wong
2018-01-27  7:32   ` Christoph Hellwig
2018-01-27  1:10 ` [PATCH 3/7] xfs: only grab shared inode locks for source file during reflink Darrick J. Wong
2018-01-27  7:33   ` Christoph Hellwig
2018-01-27  1:10 ` [PATCH 4/7] xfs: treat CoW fork operations as delalloc for quota accounting Darrick J. Wong
2018-01-27  7:33   ` Christoph Hellwig
2018-01-29 12:26   ` Brian Foster
2018-01-29 23:00     ` Darrick J. Wong
2018-01-30 11:48       ` Brian Foster
2018-01-27  1:10 ` [PATCH 5/7] iomap: warn on zero-length mappings Darrick J. Wong
2018-01-27  7:34   ` Christoph Hellwig
2018-01-27 18:04     ` Darrick J. Wong
2018-01-27 18:08   ` Darrick J. Wong [this message]
2018-01-27  1:10 ` [PATCH 6/7] xfs: check reflink allocation mappings Darrick J. Wong
2018-01-27  7:35   ` Christoph Hellwig
2018-01-27  1:10 ` [PATCH 7/7] xfs: don't screw up direct writes when freesp is fragmented Darrick J. Wong

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=20180127180855.GI9068@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=bfoster@redhat.com \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.