[Cluster-devel] [RHEL7 fs 1/3] iomap: warn on zero-length mappings

Andreas Gruenbacher agruenba at redhat.com
Tue Feb 6 18:31:50 UTC 2018


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

Bugzilla: 1542594
Upstream status: v4.15
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=15221703
Tested: locally

commit 0c6dda7a1cbd587e48bcef1999875e29549c2b41
Author: Darrick J. Wong <darrick.wong at oracle.com>
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 <darrick.wong at oracle.com>
    Reviewed-by: Christoph Hellwig <hch at lst.de>
---
 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




More information about the Cluster-devel mailing list