linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 3/11] btrfs: handle kzalloc() failure in open_ctree()
@ 2010-05-29  9:43 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2010-05-29  9:43 UTC (permalink / raw)
  To: linux-btrfs
  Cc: Yan Zheng, Josef Bacik, Jens Axboe, Christoph Hellwig,
	Chris Mason, kernel-janitors

Unwind and return -ENOMEM if the allocation fails here.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index f3b287c..73895ba 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,
 		     btrfs_level_size(tree_root,
 				      btrfs_super_log_root_level(disk_super));
 
-		log_tree_root = kzalloc(sizeof(struct btrfs_root),
-						      GFP_NOFS);
+		log_tree_root = kzalloc(sizeof(struct btrfs_root), GFP_NOFS);
+		if (!log_tree_root) {
+			err = -ENOMEM;
+			goto fail_trans_kthread;
+		}
 
 		__setup_root(nodesize, leafsize, sectorsize, stripesize,
 			     log_tree_root, fs_info, BTRFS_TREE_LOG_OBJECTID);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-05-29  9:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-29  9:43 [patch 3/11] btrfs: handle kzalloc() failure in open_ctree() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).