From patchwork Mon Sep 16 11:49:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Qi X-Patchwork-Id: 2896621 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 47FAE9F1C0 for ; Mon, 16 Sep 2013 11:51:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2D8AB2010A for ; Mon, 16 Sep 2013 11:51:42 +0000 (UTC) Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3866620103 for ; Mon, 16 Sep 2013 11:51:37 +0000 (UTC) Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r8GBp1es013274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 16 Sep 2013 11:51:01 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 r8GBovsN010170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 16 Sep 2013 11:50:57 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1VLXKT-0002RG-Ef; Mon, 16 Sep 2013 04:50:57 -0700 Received: from ucsinet22.oracle.com ([156.151.31.94]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1VLXKM-0002R5-R1 for ocfs2-devel@oss.oracle.com; Mon, 16 Sep 2013 04:50:50 -0700 Received: from userp1020.oracle.com (userp1020.oracle.com [156.151.31.79]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r8GBooFh015519 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 16 Sep 2013 11:50:50 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 r8GBolJW025924 (version=TLSv1/SSLv3 cipher=DES-CBC3-SHA bits=168 verify=FAIL) for ; Mon, 16 Sep 2013 11:50:49 GMT Received: from 172.24.2.119 (EHLO szxeml206-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BIJ16379; Mon, 16 Sep 2013 19:50:46 +0800 (CST) Received: from SZXEML418-HUB.china.huawei.com (10.82.67.157) by szxeml206-edg.china.huawei.com (172.24.2.59) with Microsoft SMTP Server (TLS) id 14.3.146.0; Mon, 16 Sep 2013 19:50:46 +0800 Received: from [127.0.0.1] (10.135.64.116) by szxeml418-hub.china.huawei.com (10.82.67.157) with Microsoft SMTP Server id 14.3.146.0; Mon, 16 Sep 2013 19:50:38 +0800 Message-ID: <5236F034.8060201@huawei.com> Date: Mon, 16 Sep 2013 19:49:08 +0800 From: Joseph Qi User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Rui Xiang References: <1378369735-12168-1-git-send-email-rui.xiang@huawei.com> <1378369735-12168-2-git-send-email-rui.xiang@huawei.com> <20130906164518.GY31381@wotan.suse.de> In-Reply-To: <20130906164518.GY31381@wotan.suse.de> X-Originating-IP: [10.135.64.116] 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=92 rcpts=1 size=1739 X-SPF-Info: PASS::szxga01-in.huawei.com X-Sendmail-CM-Score: 0.00% X-Sendmail-CM-Analysis: v=2.1 cv=C67Ql2/+ c=1 sm=1 tr=0 a=6YMIiCGU//PUEf62qScyBg==:117 a=6YMIiCGU//PUEf62qScyBg==:17 a=0JQp9YiEBiYA:10 a=_ucFIcivCngA:10 a=ijdnWhqLraAA:10 a=O9dq5j03pVQA:10 a=8nJEP1OIZ-IA:10 a=i0EeH86SAAAA:8 a=cRek0GobOAgA:10 a=yPCof4ZbAAAA:8 a= RchJ-Xv__DpJ83VKVikA:9 a=wPNLvfGTeEIA:10 a=0kPLrQdw3YYA:10 a=hPjdaMEvmhQA:10 a=7DSvI1NPTFQA:10 X-Sendmail-CT-Classification: not spam X-Sendmail-CT-RefID: str=0001.0A090203.5236F09A.0043:SCFSTAT1612107, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 Cc: Mark Fasheh , ocfs2-devel@oss.oracle.com Subject: Re: [Ocfs2-devel] [PATCH RESEND 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.9 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 On 2013/9/7 0:45, Mark Fasheh wrote: > Reviewed-by: Mark Fasheh > > On Thu, Sep 05, 2013 at 04:28:55PM +0800, Rui Xiang wrote: >> Sb_getblk may retrun an err, so add a check for bh. >> >> Signed-off-by: Rui Xiang >> Reviewed-by: Jie Liu >> --- >> 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, >> -- >> 1.8.2.2 >> >> > -- > Mark Fasheh > > _______________________________________________ > Ocfs2-devel mailing list > Ocfs2-devel@oss.oracle.com > https://oss.oracle.com/mailman/listinfo/ocfs2-devel > > Need also add a check after calling sb_getblk in ocfs2_create_xattr_block. diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index bd2a1f0..8d61105 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -2873,6 +2873,12 @@ static int ocfs2_create_xattr_block(struct inode *inode, } new_bh = sb_getblk(inode->i_sb, first_blkno); + if (!new_bh) { + ret = -ENOMEM; + mlog_errno(ret); + goto end; + } + ocfs2_set_new_buffer_uptodate(INODE_CACHE(inode), new_bh); ret = ocfs2_journal_access_xb(ctxt->handle, INODE_CACHE(inode),