diff options
author | Konstantin Khlebnikov <khlebnikov@openvz.org> | 2012-06-05 21:36:33 +0400 |
---|---|---|
committer | Ziyan <jaraidaniel@gmail.com> | 2016-01-08 10:44:49 +0100 |
commit | e9e13169869ecfd1b2566a923cf08a3d35b21614 (patch) | |
tree | 8b77ba99a90a7c8d03199fbb11e4891977a4641e /include | |
parent | f283fe332038c17c9b9859472fb19aea50cce209 (diff) | |
download | kernel_samsung_tuna-e9e13169869ecfd1b2566a923cf08a3d35b21614.zip kernel_samsung_tuna-e9e13169869ecfd1b2566a923cf08a3d35b21614.tar.gz kernel_samsung_tuna-e9e13169869ecfd1b2566a923cf08a3d35b21614.tar.bz2 |
radix-tree: fix contiguous iterator
commit fffaee365fded09f9ebf2db19066065fa54323c3 upstream.
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
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/radix-tree.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index 89122e5..4dbfe2a 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h @@ -367,8 +367,11 @@ radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, unsigned flags) 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; |