diff options
author | Christoph Hellwig <hch@tuxera.com> | 2011-09-15 10:48:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-15 12:03:17 -0400 |
commit | f1fcd9f0e96d12498afb5543107f560f196cfcf3 (patch) | |
tree | 0444192f838dc8a71b0f6d1270d979a337c6ef6f /fs/hfsplus | |
parent | f588c960fcaa6fa8bf82930bb819c9aca4eb9347 (diff) |
hfsplus: fix filesystem size checks
generic_check_addressable can't deal with hfsplus's larger than page
size allocation blocks, so simply opencode the checks that we actually
need in hfsplus_fill_super.
Signed-off-by: Christoph Hellwig <hch@tuxera.com>
Reported-by: Pavel Ivanov <paivanof@gmail.com>
Tested-by: Pavel Ivanov <paivanof@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hfsplus')
-rw-r--r-- | fs/hfsplus/super.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index cadbb8c81887..d24a9b666a23 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -344,6 +344,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
344 | struct inode *root, *inode; | 344 | struct inode *root, *inode; |
345 | struct qstr str; | 345 | struct qstr str; |
346 | struct nls_table *nls = NULL; | 346 | struct nls_table *nls = NULL; |
347 | u64 last_fs_block, last_fs_page; | ||
347 | int err; | 348 | int err; |
348 | 349 | ||
349 | err = -EINVAL; | 350 | err = -EINVAL; |
@@ -399,9 +400,13 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) | |||
399 | if (!sbi->rsrc_clump_blocks) | 400 | if (!sbi->rsrc_clump_blocks) |
400 | sbi->rsrc_clump_blocks = 1; | 401 | sbi->rsrc_clump_blocks = 1; |
401 | 402 | ||
402 | err = generic_check_addressable(sbi->alloc_blksz_shift, | 403 | err = -EFBIG; |
403 | sbi->total_blocks); | 404 | last_fs_block = sbi->total_blocks - 1; |
404 | if (err) { | 405 | last_fs_page = (last_fs_block << sbi->alloc_blksz_shift) >> |
406 | PAGE_CACHE_SHIFT; | ||
407 | |||
408 | if ((last_fs_block > (sector_t)(~0ULL) >> (sbi->alloc_blksz_shift - 9)) || | ||
409 | (last_fs_page > (pgoff_t)(~0ULL))) { | ||
405 | printk(KERN_ERR "hfs: filesystem size too large.\n"); | 410 | printk(KERN_ERR "hfs: filesystem size too large.\n"); |
406 | goto out_free_vhdr; | 411 | goto out_free_vhdr; |
407 | } | 412 | } |