Skip to contentSkip to conversation

hfsplus updates for Linux 3.1

GIT PULL New Christoph Hellwig 1 participant 4 messages Jul 22, 2011 – Sep 15, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Linus,

please pull the hfsplus updates for this merge window. The patches are largely bugfixes, but now that we have sorted the issues with incorrectly used 32-bit types we can finally enable support for volumes larger than 2 Terrabytes.

The following changes since commit ca56a95eedcc95f8fea7b49c87565cd961d74fe2:

Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 (2011-06-29 18:18:48 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/hch/hfsplus.git for-linus

Alexey Khoroshilov (3):
hfsplus: Fix double iput of the same inode in hfsplus_fill_super()
hfsplus: add error checking for hfs_find_init()
hfsplus: Add error propagation for hfsplus_ext_write_extent_locked

Anton Salikhmetov (1):
hfsplus: assignments inside `if' condition clean-up

Christoph Hellwig (3):
hfsplus: fix overflow in hfsplus_get_block
hfsplus: fix overflow in hfsplus_read_wrapper
hfsplus: lift the 2TB size limit

Naohiro Aota (1):
hfsplus: Add additional range check to handle on-disk corruptions

Seth Forshee (2):
hfsplus: add missing call to bio_put()
hfsplus: ensure bio requests are not smaller than the hardware sectors

 fs/hfsplus/brec.c       |    4 ++
 fs/hfsplus/catalog.c    |   14 +++++--
 fs/hfsplus/dir.c        |    8 +++-
 fs/hfsplus/extents.c    |   50 +++++++++++++++++-------
 fs/hfsplus/hfsplus_fs.h |   18 +++++++-
 fs/hfsplus/inode.c      |   12 +++--
 fs/hfsplus/part_tbl.c   |   32 +++++++++-------
 fs/hfsplus/super.c      |   45 +++++++++++++++-------
 fs/hfsplus/unicode.c    |   35 +++++++++++++----
 fs/hfsplus/wrapper.c    |   97 ++++++++++++++++++++++++++++++++++-------------
 10 files changed, 224 insertions(+), 91 deletions(-)
#1 lore raw

cover hfsplus regression fixes

Hi Linus,

two small patches to fix regressions introduced in the Linux 3.1 cycle.

Given that it's just two patches I have't bothered setting up an alternate git tree for now.

#2 lore raw

PATCH 1/2 hfsplus: Fix kfree of wrong pointers in hfsplus_fill_super() error path

From: Seth Forshee <[email protected]>

Commit 6596528 (hfsplus: ensure bio requests are not smaller than the hardware sectors) changed the pointers used for volume header allocations but failed to free the correct pointers in the error path path of hfsplus_fill_super() and hfsplus_read_wrapper.

The second hunk came from a separate patch by Pavel Ivanov.

---
 fs/hfsplus/super.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/hfsplus/super.c +2 -2
Index: linux-2.6/fs/hfsplus/super.c
===================================================================
@@ -525,8 +525,8 @@ out_close_cat_tree:
 out_close_ext_tree:
 	hfs_btree_close(sbi->ext_tree);
 out_free_vhdr:
-	kfree(sbi->s_vhdr);
-	kfree(sbi->s_backup_vhdr);
+	kfree(sbi->s_vhdr_buf);
+	kfree(sbi->s_backup_vhdr_buf);
 out_unload_nls:
 	unload_nls(sbi->nls);
 	unload_nls(nls);
fs/hfsplus/wrapper.c +2 -2
Index: linux-2.6/fs/hfsplus/wrapper.c
===================================================================
@@ -272,9 +272,9 @@ reread:
 	return 0;
 
 out_free_backup_vhdr:
-	kfree(sbi->s_backup_vhdr);
+	kfree(sbi->s_backup_vhdr_buf);
 out_free_vhdr:
-	kfree(sbi->s_vhdr);
+	kfree(sbi->s_vhdr_buf);
 out:
 	return error;
 }
#3 lore raw

PATCH 2/2 hfsplus: fix filesystem size checks

In reply to Christoph Hellwig

From: Christoph Hellwig <[email protected]>

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.

fs/hfsplus/super.c +8 -3
Index: linux-2.6/fs/hfsplus/super.c
===================================================================
@@ -344,6 +344,7 @@ static int hfsplus_fill_super(struct sup
 	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 sup
 	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;
 	}