From patchwork Tue Mar 26 10:36:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fanchaoting X-Patchwork-Id: 2335741 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 1BA70DF264 for ; Tue, 26 Mar 2013 11:11:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753525Ab3CZLLn (ORCPT ); Tue, 26 Mar 2013 07:11:43 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:64691 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753066Ab3CZLLm (ORCPT ); Tue, 26 Mar 2013 07:11:42 -0400 X-IronPort-AV: E=Sophos;i="4.87,352,1363104000"; d="scan'208";a="6947844" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 26 Mar 2013 19:09:07 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r2QAZX99018662; Tue, 26 Mar 2013 18:35:34 +0800 Received: from [127.0.0.1] ([10.167.233.142]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013032618344784-61443 ; Tue, 26 Mar 2013 18:34:47 +0800 Message-ID: <51517A15.3010805@cn.fujitsu.com> Date: Tue, 26 Mar 2013 18:36:05 +0800 From: fanchaoting User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Benny Halevy CC: "linux-nfs@vger.kernel.org" Subject: [PATCH] pnfsd-block: cause oops when alloc pnfs_blocklayout_layout_t fail X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/03/26 18:34:47, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/03/26 18:34:49, Serialize complete at 2013/03/26 18:34:49 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org if using dprintk and alloc pnfs_blocklayout_layout_t fail, it maybe cause oops. we should assert the new pnfs_blocklayout_layout_t is not null first. Signed-off-by: fanchaoting Reviewed-by: chendt.fnst --- fs/nfsd/bl_ops.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/bl_ops.c b/fs/nfsd/bl_ops.c index fa129e8..a7046c6 100644 --- a/fs/nfsd/bl_ops.c +++ b/fs/nfsd/bl_ops.c @@ -1210,14 +1210,14 @@ layout_cache_fill_from_list(bl_layout_rec_t *r, struct list_head *h, n = bll_alloc(seg->offset, MIN(seg->length, BLL_F_END(b) - seg->offset), BLOCK_LAYOUT_CACHE, h); + if (!n) + return False; + dprintk(" CACHE hit: Found %Lu(f):%Lu(l): " "in %Lu(f):%Lu(l):%Lu(s):%d\n", _2SECTS(n->bll_foff), _2SECTS(n->bll_len), _2SECTS(b->bll_foff), _2SECTS(b->bll_len), _2SECTS(b->bll_soff), b->bll_es); - if (!n) - return False; - n->bll_soff = b->bll_soff + seg->offset - b->bll_foff; n->bll_vol_id.sbid = sbid; n->bll_vol_id.devid = b->bll_vol_id.devid;