From 98083f36e7db9bec61cd511a8ca05635cff72ef0 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 15 Sep 2011 10:48:40 -0400 Subject: [PATCH] --- yaml --- r: 263837 b: refs/heads/master c: f1fcd9f0e96d12498afb5543107f560f196cfcf3 h: refs/heads/master i: 263835: f26b6d517be00ed692b104f52f2eb6196332bb5b v: v3 --- [refs] | 2 +- trunk/fs/hfsplus/super.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 4b08274447a5..18c2b2314d61 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f588c960fcaa6fa8bf82930bb819c9aca4eb9347 +refs/heads/master: f1fcd9f0e96d12498afb5543107f560f196cfcf3 diff --git a/trunk/fs/hfsplus/super.c b/trunk/fs/hfsplus/super.c index cadbb8c81887..d24a9b666a23 100644 --- a/trunk/fs/hfsplus/super.c +++ b/trunk/fs/hfsplus/super.c @@ -344,6 +344,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) struct inode *root, *inode; struct qstr str; struct nls_table *nls = NULL; + u64 last_fs_block, last_fs_page; int err; err = -EINVAL; @@ -399,9 +400,13 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) if (!sbi->rsrc_clump_blocks) sbi->rsrc_clump_blocks = 1; - err = generic_check_addressable(sbi->alloc_blksz_shift, - sbi->total_blocks); - if (err) { + err = -EFBIG; + last_fs_block = sbi->total_blocks - 1; + 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"); goto out_free_vhdr; }