aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <khlebnikov@openvz.org>2012-06-05 13:36:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-06-05 13:46:40 -0400
commitfffaee365fded09f9ebf2db19066065fa54323c3 (patch)
treef6a6d331fa62c9814f9875a845afad1e7994cbde /lib
parentf9ba7179ce91fb77b2adf6eaab3676ab3a1f5a15 (diff)
radix-tree: fix contiguous iterator
This patch fixes bug in macro radix_tree_for_each_contig(). If radix_tree_next_slot() sees NULL in next slot it returns NULL, but following radix_tree_next_chunk() switches iterating into next chunk. As result iterating becomes non-contiguous and breaks vfs "splice" and all its users. Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Reported-and-bisected-by: Hans de Bruin <jmdebruin@xmsnet.nl> Reported-and-bisected-by: Ondrej Zary <linux@rainbow-software.org> Reported-bisected-and-tested-by: Toralf Förster <toralf.foerster@gmx.de> Link: https://lkml.org/lkml/2012/6/5/64 Cc: stable <stable@vger.kernel.org> # 3.4.x Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/radix-tree.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index d7c878cc006c..e7964296fd50 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -686,6 +686,9 @@ void **radix_tree_next_chunk(struct radix_tree_root *root,
686 * during iterating; it can be zero only at the beginning. 686 * during iterating; it can be zero only at the beginning.
687 * And we cannot overflow iter->next_index in a single step, 687 * And we cannot overflow iter->next_index in a single step,
688 * because RADIX_TREE_MAP_SHIFT < BITS_PER_LONG. 688 * because RADIX_TREE_MAP_SHIFT < BITS_PER_LONG.
689 *
690 * This condition also used by radix_tree_next_slot() to stop
691 * contiguous iterating, and forbid swithing to the next chunk.
689 */ 692 */
690 index = iter->next_index; 693 index = iter->next_index;
691 if (!index && iter->index) 694 if (!index && iter->index)