The patch titled
From: Konstantin Khlebnikov <[email protected]>
has been added to the -mm tree. Its filename is
radix-tree-fix-contiguous-iterator.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Konstantin Khlebnikov <[email protected]>
Subject: radix-tree: fix contiguous iterator
Fix a bug in the 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.
More details at https://lkml.org/lkml/2012/6/5/64
Signed-off-by: Konstantin Khlebnikov <[email protected]>
Reported-by: Hans de Bruin <[email protected]>
Reported-by: Ondrej Zary <[email protected]>
Reported-by: Toralf Foerster <[email protected]>
Cc: <[email protected]> [3.4.x]
Signed-off-by: Andrew Morton <[email protected]>
---
include/linux/radix-tree.h | 5 ++++-
lib/radix-tree.c | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
diff -puN include/linux/radix-tree.h~radix-tree-fix-contiguous-iterator
include/linux/radix-tree.h
--- a/include/linux/radix-tree.h~radix-tree-fix-contiguous-iterator
+++ a/include/linux/radix-tree.h
@@ -368,8 +368,11 @@ radix_tree_next_slot(void **slot, struct
iter->index++;
if (likely(*slot))
return slot;
- if (flags & RADIX_TREE_ITER_CONTIG)
+ if (flags & RADIX_TREE_ITER_CONTIG) {
+ /* forbid switching to the next chunk */
+ iter->next_index = 0;
break;
+ }
}
}
return NULL;
diff -puN lib/radix-tree.c~radix-tree-fix-contiguous-iterator lib/radix-tree.c
--- a/lib/radix-tree.c~radix-tree-fix-contiguous-iterator
+++ a/lib/radix-tree.c
@@ -686,6 +686,9 @@ void **radix_tree_next_chunk(struct radi
* during iterating; it can be zero only at the beginning.
* And we cannot overflow iter->next_index in a single step,
* because RADIX_TREE_MAP_SHIFT < BITS_PER_LONG.
+ *
+ * This condition also used by radix_tree_next_slot() to stop
+ * contiguous iterating, and forbid swithing to the next chunk.
*/
index = iter->next_index;
if (!index && iter->index)
_
Subject: From: Konstantin Khlebnikov <[email protected]>
Patches currently in -mm which might be from [email protected] are
linux-next.patch
radix-tree-fix-contiguous-iterator.patch
mm-correctly-synchronize-rss-counters-at-exit-exec.patch
c-r-prctl-add-ability-to-set-new-mm_struct-exe_file-update-after-mm-num_exe_file_vmas-removal.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html