From patchwork Tue Mar 12 06:09:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fanchaoting X-Patchwork-Id: 2253411 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id CB56E3FCF6 for ; Tue, 12 Mar 2013 06:09:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754747Ab3CLGJC (ORCPT ); Tue, 12 Mar 2013 02:09:02 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:23893 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754315Ab3CLGJB (ORCPT ); Tue, 12 Mar 2013 02:09:01 -0400 X-IronPort-AV: E=Sophos;i="4.84,827,1355068800"; d="scan'208";a="6856738" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 12 Mar 2013 14:06:33 +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 r2C68xvH011148; Tue, 12 Mar 2013 14:08:59 +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 2013031214074633-785844 ; Tue, 12 Mar 2013 14:07:46 +0800 Message-ID: <513EC692.4090907@cn.fujitsu.com> Date: Tue, 12 Mar 2013 14:09:22 +0800 From: fanchaoting User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: "Myklebust, Trond" CC: "linux-nfs@vger.kernel.org" Subject: [PATCH] pnfs-block: may be return NULL when find a extent X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/03/12 14:07:46, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/03/12 14:07:46, Serialize complete at 2013/03/12 14:07:46 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org maybe return NULL when find a extent, if we use it later, it will cause oops. Signed-off-by: fanchaoting --- fs/nfs/blocklayout/extents.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfs/blocklayout/extents.c b/fs/nfs/blocklayout/extents.c index 9c3e117..131ea59 100644 --- a/fs/nfs/blocklayout/extents.c +++ b/fs/nfs/blocklayout/extents.c @@ -762,6 +762,11 @@ set_to_rw(struct pnfs_block_layout *bl, u64 offset, u64 length) spin_lock(&bl->bl_ext_lock); be = bl_find_get_extent_locked(bl, offset); + if (!be) { + spin_unlock(&bl->bl_ext_lock); + goto out_nosplit; + } + rv = be->be_f_offset + be->be_length; if (be->be_state != PNFS_BLOCK_INVALID_DATA) { spin_unlock(&bl->bl_ext_lock);