From patchwork Sat May 29 09:43:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 103023 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4T9hVjf026276 for ; Sat, 29 May 2010 09:43:32 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755578Ab0E2Jna (ORCPT ); Sat, 29 May 2010 05:43:30 -0400 Received: from ey-out-2122.google.com ([74.125.78.26]:52784 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754090Ab0E2Jn2 (ORCPT ); Sat, 29 May 2010 05:43:28 -0400 Received: by ey-out-2122.google.com with SMTP id d26so121925eyd.19 for ; Sat, 29 May 2010 02:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=U08SwhJ5JItlqRO5i6vkVggXhJHS0in9HKN8utlhNOY=; b=QPY91z8zBRkCUkZyEk+E890fKkaLxmTiGHjUT1mt3puYYyzeIzv3M1UF/eVWjoa9su khA7mjOIUTaZE+wEfhAWDxJL5dNor0mVLZaY/vzjtXumRxhVwdEP7QmcTiWL0giTuNfN Zs99qe27JgnsLeDiQgAmI2NYmVEQeNFk28twM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=HCa56/9kRI0+a0Q+qEZwER4Arl+OZQJrDWLYgSqtjq0CBUyOXJix2lMT2C3dBpXcot m5vK5w8an58DyC+B22OLcD0cH3pmcgHbdtYcJYEl22OfJNhLTZxj8IrqScSHOqXjVdNt iZMptAxno+3ERi93GJIddvswNjZbxHkIzZsCY= Received: by 10.213.7.20 with SMTP id b20mr3660056ebb.66.1275126207213; Sat, 29 May 2010 02:43:27 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id 14sm1719346ewy.10.2010.05.29.02.43.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 29 May 2010 02:43:26 -0700 (PDT) Date: Sat, 29 May 2010 11:43:07 +0200 From: Dan Carpenter To: linux-btrfs@vger.kernel.org Cc: Yan Zheng , Josef Bacik , Jens Axboe , Christoph Hellwig , Chris Mason , kernel-janitors@vger.kernel.org Subject: [patch 3/11] btrfs: handle kzalloc() failure in open_ctree() Message-ID: <20100529094307.GD5483@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 29 May 2010 09:43:32 +0000 (UTC) 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);