From patchwork Wed Jan 19 14:08:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liu weni X-Patchwork-Id: 489061 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0JEuJCi010815 for ; Wed, 19 Jan 2011 17:01:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753943Ab1ASOIo (ORCPT ); Wed, 19 Jan 2011 09:08:44 -0500 Received: from mail-pv0-f174.google.com ([74.125.83.174]:37554 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752850Ab1ASOIn (ORCPT ); Wed, 19 Jan 2011 09:08:43 -0500 Received: by pva4 with SMTP id 4so149777pva.19 for ; Wed, 19 Jan 2011 06:08:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=jf0+TOXXV6pCjrMMhgeDlECSeIwMmcirrkstDu0DEwE=; b=no6gKv3+WF+r2302YXQsZKhdBFc//HF4DdVu9Xm5WSy+CjyTuKX8MtCOGMrKJKMF4Y Lt2n+pVdjhLdQlQFR+vrk+i2jyD9YhGAER8+0hrG/qi8Lt2ZuNMk/Xb1J3yanGbWFiXi jVe3f4AtJnYLMOk80yO1pE+UHhxNiwd9I1fl0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=c4JhkB6S5oDIdo3TWzbgLeQYuvki20c1ovhBuPl7Plb0BWoeSArcbfE6QEUC1IOg8Q MPgBltbjhJEtNZ3psXUiN+8mdr47Joz/yJLkBwWBc01hEh1I+ilo690yKj8qxctc9CuE mMCjBLCfMMemwi6choFyJ5C7Uy4TU7u/zPJ+s= Received: by 10.142.178.9 with SMTP id a9mr650503wff.263.1295446122767; Wed, 19 Jan 2011 06:08:42 -0800 (PST) Received: from [192.168.1.102] ([202.115.1.35]) by mx.google.com with ESMTPS id w22sm9625975wfd.19.2011.01.19.06.08.36 (version=SSLv3 cipher=RC4-MD5); Wed, 19 Jan 2011 06:08:41 -0800 (PST) Message-ID: <4D36F04D.70505@gmail.com> Date: Wed, 19 Jan 2011 22:08:13 +0800 From: Liuwenyi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: strongzgy@gmail.com, onlyflyer@gmail.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, ak@linux.intel.com, akpm@linux-foundation.org, miaox@cn.fujitsu.com, josef@redhat.com, chris.mason@oracle.com, Yang Ruirui , meego-kernel@meego.com, qingshenlwy@gmail.com Subject: [PATCH] Avoid a NULL pointer in btrfs 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.6 (demeter1.kernel.org [140.211.167.41]); Wed, 19 Jan 2011 17:01:28 +0000 (UTC) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 5e7a94d..0da42b5 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -1553,6 +1553,9 @@ int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, struct rb_node *node; int bitset = 0; + if (tree == NULL) + return bitset; + spin_lock(&tree->lock); if (cached && cached->tree && cached->start == start)