Commit f1fcd9f0 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

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: default avatarChristoph Hellwig <hch@tuxera.com>
Reported-by: default avatarPavel Ivanov <paivanof@gmail.com>
Tested-by: default avatarPavel Ivanov <paivanof@gmail.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f588c960
...@@ -344,6 +344,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) ...@@ -344,6 +344,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
struct inode *root, *inode; struct inode *root, *inode;
struct qstr str; struct qstr str;
struct nls_table *nls = NULL; struct nls_table *nls = NULL;
u64 last_fs_block, last_fs_page;
int err; int err;
err = -EINVAL; err = -EINVAL;
...@@ -399,9 +400,13 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) ...@@ -399,9 +400,13 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
if (!sbi->rsrc_clump_blocks) if (!sbi->rsrc_clump_blocks)
sbi->rsrc_clump_blocks = 1; sbi->rsrc_clump_blocks = 1;
err = generic_check_addressable(sbi->alloc_blksz_shift, err = -EFBIG;
sbi->total_blocks); last_fs_block = sbi->total_blocks - 1;
if (err) { last_fs_page = (last_fs_block << sbi->alloc_blksz_shift) >>
PAGE_CACHE_SHIFT;
if ((last_fs_block > (sector_t)(~0ULL) >> (sbi->alloc_blksz_shift - 9)) ||
(last_fs_page > (pgoff_t)(~0ULL))) {
printk(KERN_ERR "hfs: filesystem size too large.\n"); printk(KERN_ERR "hfs: filesystem size too large.\n");
goto out_free_vhdr; goto out_free_vhdr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment