aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfsplus/super.c')
-rw-r--r--fs/hfsplus/super.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index c106ca22e812..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 }
@@ -525,8 +530,8 @@ out_close_cat_tree:
525out_close_ext_tree: 530out_close_ext_tree:
526 hfs_btree_close(sbi->ext_tree); 531 hfs_btree_close(sbi->ext_tree);
527out_free_vhdr: 532out_free_vhdr:
528 kfree(sbi->s_vhdr); 533 kfree(sbi->s_vhdr_buf);
529 kfree(sbi->s_backup_vhdr); 534 kfree(sbi->s_backup_vhdr_buf);
530out_unload_nls: 535out_unload_nls:
531 unload_nls(sbi->nls); 536 unload_nls(sbi->nls);
532 unload_nls(nls); 537 unload_nls(nls);