aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2014-02-23 23:12:41 +0900
committerDaniel Phillips <daniel@tux3.org>2014-02-23 23:12:41 +0900
commit414ba309bdbf24623ace862bc32595a42bc03d87 (patch)
tree4d9517c1354285b8d511142e56a3cc0421d35f11
parentb2b30e83b4942c26b502f3dfab12c78eb428a1fd (diff)
downloadlinux-tux3-414ba309bdbf24623ace862bc32595a42bc03d87.tar.gz
tux3: Fix overflow case on truncate path
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-rw-r--r--fs/tux3/inode.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/tux3/inode.c b/fs/tux3/inode.c
index b31fea57ae95fb..8eb53047850a27 100644
--- a/fs/tux3/inode.c
+++ b/fs/tux3/inode.c
@@ -597,12 +597,15 @@ static int tux3_truncate(struct inode *inode, loff_t newsize)
i_size_write(inode, newsize);
/* Roundup. Partial page is handled by tux3_truncate_partial_block() */
holebegin = round_up(newsize, boundary);
+ if (newsize <= holebegin) { /* Check overflow */
#ifdef __KERNEL__
- /* FIXME: The buffer fork before invalidate. We should merge to
- * truncate_pagecache() */
- tux3_truncate_inode_pages_range(inode->i_mapping, holebegin, LLONG_MAX);
+ /* FIXME: The buffer fork before invalidate. We should merge to
+ * truncate_pagecache() */
+ tux3_truncate_inode_pages_range(inode->i_mapping, holebegin,
+ LLONG_MAX);
#endif
- truncate_pagecache(inode, oldsize, holebegin);
+ truncate_pagecache(inode, oldsize, holebegin);
+ }
if (!is_expand) {
err = tux3_add_truncate_hole(inode, newsize);