From patchwork Mon Sep 2 11:15:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Xiang X-Patchwork-Id: 3907121 Return-Path: X-Original-To: patchwork-ocfs2-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8B71A9F334 for ; Fri, 28 Mar 2014 21:06:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B741020353 for ; Fri, 28 Mar 2014 21:06:30 +0000 (UTC) Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 357182034E for ; Fri, 28 Mar 2014 21:06:28 +0000 (UTC) Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s2SL6FAS024197 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 28 Mar 2014 21:06:16 GMT Received: from oss.oracle.com (oss-external.oracle.com [137.254.96.51]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s2SL6FOD004407 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Mar 2014 21:06:15 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1WTdyh-0005Sz-41; Fri, 28 Mar 2014 14:06:15 -0700 Received: from acsinet21.oracle.com ([141.146.126.237]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1VGS8B-0004HV-3V for ocfs2-devel@oss.oracle.com; Mon, 02 Sep 2013 04:17:15 -0700 Received: from userp1020.oracle.com (userp1020.oracle.com [156.151.31.79]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r82BHEOK023029 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 2 Sep 2013 11:17:14 GMT Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [119.145.14.64]) by userp1020.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r82BHADg027529 (version=TLSv1/SSLv3 cipher=DES-CBC3-SHA bits=168 verify=FAIL) for ; Mon, 2 Sep 2013 11:17:13 GMT Received: from 172.24.2.119 (EHLO szxeml205-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BHP56574; Mon, 02 Sep 2013 19:16:10 +0800 (CST) Received: from SZXEML406-HUB.china.huawei.com (10.82.67.93) by szxeml205-edg.china.huawei.com (172.24.2.58) with Microsoft SMTP Server (TLS) id 14.1.323.7; Mon, 2 Sep 2013 19:16:07 +0800 Received: from localhost (10.135.72.188) by szxeml406-hub.china.huawei.com (10.82.67.93) with Microsoft SMTP Server id 14.1.323.7; Mon, 2 Sep 2013 19:16:01 +0800 From: Rui Xiang To: Andrew Morton , Mark Fasheh , Joel Becker Date: Mon, 2 Sep 2013 19:15:50 +0800 Message-ID: <1378120550-7216-2-git-send-email-rui.xiang@huawei.com> X-Mailer: git-send-email 1.8.1.msysgit.1 In-Reply-To: <1378120550-7216-1-git-send-email-rui.xiang@huawei.com> References: <1378120550-7216-1-git-send-email-rui.xiang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.135.72.188] X-CFilter-Loop: Reflected X-Flow-Control-Info: class=Pass-to-MM reputation=ipRisk-All ip=119.145.14.64 ct-class=T1 ct-vol1=0 ct-vol2=6 ct-vol3=5 ct-risk=10 ct-spam1=0 ct-spam2=0 ct-bulk=90 rcpts=1 size=708 X-SPF-Info: PASS::szxga01-in.huawei.com X-Sendmail-CM-Score: 0.00% X-Sendmail-CM-Analysis: v=2.1 cv=Na/fiQz4 c=1 sm=1 tr=0 a=6YMIiCGU//PUEf62qScyBg==:117 a=6YMIiCGU//PUEf62qScyBg==:17 a=Wbe7W7_4SJkA:10 a=EGEljGSJ_3oA:10 a=O9dq5j03pVQA:10 a=wPDyFdB5xvgA:10 a=i0EeH86SAAAA:8 a=qCqdqwxhUycA:10 a=yMFayeqLlTOHGlG36-oA:9 a=hPjdaMEvmh QA:10 X-Sendmail-CT-Classification: not spam X-Sendmail-CT-RefID: str=0001.0A090204.522473BA.0020:SCFSTAT1612107, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-Mailman-Approved-At: Fri, 28 Mar 2014 14:06:12 -0700 Cc: ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 2/2] ocfs2: add necessary check in case sb_getblk fails X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sb_getblk may retrun an err, so add a check for bh. Signed-off-by: Rui Xiang --- fs/ocfs2/refcounttree.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 50c1796..22f3f19 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c @@ -612,6 +612,11 @@ static int ocfs2_create_refcount_tree(struct inode *inode, } new_bh = sb_getblk(inode->i_sb, first_blkno); + if (!new_bh) { + ret = -ENOMEM; + mlog_errno(ret); + goto out_commit; + } ocfs2_set_new_buffer_uptodate(&new_tree->rf_ci, new_bh); ret = ocfs2_journal_access_rb(handle, &new_tree->rf_ci, new_bh,