[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4D36F04D.70505@gmail.com>
Date: Wed, 19 Jan 2011 22:08:13 +0800
From: Liuwenyi <qingshenlwy@...il.com>
To: strongzgy@...il.com, onlyflyer@...il.com,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
ak@...ux.intel.com, akpm@...ux-foundation.org,
miaox@...fujitsu.com, josef@...hat.com, chris.mason@...cle.com,
Yang Ruirui <ruirui.r.yang@...to.com>, meego-kernel@...go.com,
qingshenlwy@...il.com
Subject: [PATCH] Avoid a NULL pointer in btrfs
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@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists