From: Liuwenyi <qingshenlwy@gmail.com>
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.
Subject: [PATCH] Avoid a NULL pointer in btrfs
Date: Wed, 19 Jan 2011 22:08:13 +0800 [thread overview]
Message-ID: <4D36F04D.70505@gmail.com> (raw)
In Yang Ruirui's mail, the btrfs will create a oops. This is caused by a
null pointer in test_range_bit() while lock the spinlock.
So, It is necessary to add a pointer check into test_range_bit()
---
Signed-off-by: Liu Wenyi <qingshenlwy@gmail.com>
---
fs/btrfs/extent_io.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
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)
node = &cached->rb_node;
--
1.7.3.3
---
Best Regards,
Liu Wenyi
next reply other threads:[~2011-01-19 14:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-19 14:08 Liuwenyi [this message]
2011-01-19 14:14 ` [PATCH] Avoid a NULL pointer in btrfs Josef Bacik
2011-01-19 15:52 ` Chris Mason
2011-01-20 12:26 ` Liuwenyi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D36F04D.70505@gmail.com \
--to=qingshenlwy@gmail.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=josef@redhat. \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miaox@cn.fujitsu.com \
--cc=onlyflyer@gmail.com \
--cc=strongzgy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).