Skip to content

Commit 3fa36ac

Browse files
Hugh Dickinstorvalds
authored andcommitted
radix_tree: clean away saw_unset_tag leftovers
radix_tree_tag_get()'s BUG (when it sees a tag after saw_unset_tag) was unsafe and removed in 2.6.34, but the pointless saw_unset_tag left behind. Remove it now, and return 0 as soon as we see unset tag - we already rely upon the root tag to be correct, returning 0 immediately if it's not set. Signed-off-by: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 0dabec9 commit 3fa36ac

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

‎lib/radix-tree.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,6 @@ int radix_tree_tag_get(struct radix_tree_root *root,
576576
{
577577
unsigned int height, shift;
578578
struct radix_tree_node *node;
579-
int saw_unset_tag = 0;
580579

581580
/* check the root's tag bit */
582581
if (!root_tag_get(root, tag))
@@ -603,15 +602,10 @@ int radix_tree_tag_get(struct radix_tree_root *root,
603602
return 0;
604603

605604
offset = (index >> shift) & RADIX_TREE_MAP_MASK;
606-
607-
/*
608-
* This is just a debug check. Later, we can bale as soon as
609-
* we see an unset tag.
610-
*/
611605
if (!tag_get(node, tag, offset))
612-
saw_unset_tag = 1;
606+
return 0;
613607
if (height == 1)
614-
return !!tag_get(node, tag, offset);
608+
return 1;
615609
node = rcu_dereference_raw(node->slots[offset]);
616610
shift -= RADIX_TREE_MAP_SHIFT;
617611
height--;

0 commit comments

Comments
 (0)