[PATCH 1/5] rtth: fix Segmentation fault

From: Hugh Dickins
Date: Sat Dec 17 2011 - 02:54:12 EST


rtth radix_tree source was updated but never tested after the update??
Currently gives Segmentation fault after big_gang_check() because we
forget to remove the low bitflag from the node address in rnode:
for which we need indirect_to_ptr() not radix_tree_deref_slot().

Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
---

test.c | 2 +-
test.h | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)

--- rtth0/test.c 2010-11-10 16:35:29.000000000 -0800
+++ rtth1/test.c 2011-12-16 18:44:02.475897094 -0800
@@ -184,7 +184,7 @@ void verify_tag_consistency(struct radix
{
if (!root->height)
return;
- verify_node(radix_tree_deref_slot((void **)&root->rnode),
+ verify_node(indirect_to_ptr(root->rnode),
tag, root->height, !!root_tag_get(root, tag));
}

--- rtth0/test.h 2010-08-25 13:30:45.000000000 -0700
+++ rtth1/test.h 2011-12-16 18:44:02.475897094 -0800
@@ -18,6 +18,11 @@ struct radix_tree_node {
unsigned long tags[RADIX_TREE_MAX_TAGS][RADIX_TREE_TAG_LONGS];
};

+static inline void *indirect_to_ptr(void *ptr)
+{
+ return (void *)((unsigned long)ptr & ~RADIX_TREE_INDIRECT_PTR);
+}
+
unsigned long radix_tree_maxindex(unsigned int height);
int root_tag_get(struct radix_tree_root *root, unsigned int tag);
/* Upto here */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/