History

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.

Konstantin Khlebnikov committed 14 years ago

Commit fffaee31 parent f9ba7172 files · +7 −1Browse files

Showing the changes to include/linux (1 of 2 files). Show all

Unified · Split

include/linux/radix-tree.h+4−1
@@ -368,8 +368,11 @@ radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, unsigned flags) · 367 unmodified lines
368368 iter->index++;
369369 if (likely(*slot))
370370 return slot;
371− if (flags & RADIX_TREE_ITER_CONTIG)
371+ if (flags & RADIX_TREE_ITER_CONTIG) {
372+ /* forbid switching to the next chunk */
373+ iter->next_index = 0;
372374 break;
375+ }
373376 }
374377 }
375378 return NULL;