summaryrefslogtreecommitdiffstats
path: root/fs/iomap.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-01-26 11:11:20 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2018-01-29 07:27:24 -0800
commit0c6dda7a1cbd587e48bcef1999875e29549c2b41 (patch)
tree932813f135f482ab48791b3bb5a5dc61aa510564 /fs/iomap.c
parent4b4c1326fd7c7210d23d9dd3bfc51f2b6477bb9e (diff)
downloadlinux-0c6dda7a1cbd587e48bcef1999875e29549c2b41.tar.bz2
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@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/iomap.c')
-rw-r--r--fs/iomap.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/iomap.c b/fs/iomap.c
index e5de7725f18a..afd163586aa0 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,