From: Andreas Gruenbacher Date: Tue, 6 Feb 2018 19:31:50 +0100 Subject: [Cluster-devel] [RHEL7 fs 1/3] iomap: warn on zero-length mappings In-Reply-To: <20180206183152.4758-1-agruenba@redhat.com> References: <20180206183152.4758-1-agruenba@redhat.com> Message-ID: <20180206183152.4758-2-agruenba@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit From: "Darrick J. Wong" Bugzilla: 1542594 Upstream status: v4.15 Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=15221703 Tested: locally commit 0c6dda7a1cbd587e48bcef1999875e29549c2b41 Author: Darrick J. Wong Date: Fri Jan 26 11:11:20 2018 -0800 iomap: warn on zero-length mappings 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 Reviewed-by: Christoph Hellwig --- fs/iomap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/iomap.c b/fs/iomap.c index ca77b55ca134..4b8dc781bbd3 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -63,6 +63,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, -- 2.14.3