summaryrefslogtreecommitdiff
path: root/fs/hfsplus/btree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@tuxera.com>2010-10-14 09:54:23 -0400
committerChristoph Hellwig <hch@lst.de>2010-10-14 09:54:23 -0400
commit13571a6977f821fab7d9c3cc5f75da52b7732e40 (patch)
tree32b50f122fc37256d3ff8ad40ec905d0c3e540ea /fs/hfsplus/btree.c
parent9250f925972d03ccc0c0a4dd4e9b794d2ef6d52b (diff)
downloadlwn-13571a6977f821fab7d9c3cc5f75da52b7732e40.tar.gz
lwn-13571a6977f821fab7d9c3cc5f75da52b7732e40.zip
hfsplus: validate btree flags
Signed-off-by: Christoph Hellwig <hch@tuxera.com>
Diffstat (limited to 'fs/hfsplus/btree.c')
-rw-r--r--fs/hfsplus/btree.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c
index 82caff215e08..22e4d4e32999 100644
--- a/fs/hfsplus/btree.c
+++ b/fs/hfsplus/btree.c
@@ -71,6 +71,11 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
tree->max_key_len);
goto fail_page;
}
+ if (tree->attributes & HFS_TREE_VARIDXKEYS) {
+ printk(KERN_ERR "hfs: invalid extent btree flag\n");
+ goto fail_page;
+ }
+
tree->keycmp = hfsplus_ext_cmp_key;
break;
case HFSPLUS_CAT_CNID:
@@ -79,6 +84,10 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
tree->max_key_len);
goto fail_page;
}
+ if (!(tree->attributes & HFS_TREE_VARIDXKEYS)) {
+ printk(KERN_ERR "hfs: invalid catalog btree flag\n");
+ goto fail_page;
+ }
if (test_bit(HFSPLUS_SB_HFSX, &HFSPLUS_SB(sb)->flags) &&
(head->key_type == HFSPLUS_KEY_BINARY))
@@ -93,6 +102,11 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
goto fail_page;
}
+ if (!(tree->attributes & HFS_TREE_BIGKEYS)) {
+ printk(KERN_ERR "hfs: invalid btree flag\n");
+ goto fail_page;
+ }
+
size = tree->node_size;
if (!is_power_of_2(size))
goto fail_page;