diff options
author | Dan Carpenter <error27@gmail.com> | 2010-05-29 05:43:07 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2010-06-11 15:57:34 -0400 |
commit | 676e4c86391936795c82ccd11ca9671ee6307936 (patch) | |
tree | b39173542a91c008d54d1acf6463b874793accee /fs | |
parent | fb4f6f910ca6f58564c31a680ef88940d8192713 (diff) |
Btrfs: handle kzalloc() failure in open_ctree()
Unwind and return -ENOMEM if the allocation fails here.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/disk-io.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index f3b287c22caf..73895baf6e07 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1941,8 +1941,11 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1941 | btrfs_level_size(tree_root, | 1941 | btrfs_level_size(tree_root, |
1942 | btrfs_super_log_root_level(disk_super)); | 1942 | btrfs_super_log_root_level(disk_super)); |
1943 | 1943 | ||
1944 | log_tree_root = kzalloc(sizeof(struct btrfs_root), | 1944 | log_tree_root = kzalloc(sizeof(struct btrfs_root), GFP_NOFS); |
1945 | GFP_NOFS); | 1945 | if (!log_tree_root) { |
1946 | err = -ENOMEM; | ||
1947 | goto fail_trans_kthread; | ||
1948 | } | ||
1946 | 1949 | ||
1947 | __setup_root(nodesize, leafsize, sectorsize, stripesize, | 1950 | __setup_root(nodesize, leafsize, sectorsize, stripesize, |
1948 | log_tree_root, fs_info, BTRFS_TREE_LOG_OBJECTID); | 1951 | log_tree_root, fs_info, BTRFS_TREE_LOG_OBJECTID); |