+ radix-tree-fix-contiguous-iterator.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     From: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxx>
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 <khlebnikov@xxxxxxxxxx>
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 <khlebnikov@xxxxxxxxxx>
Reported-by: Hans de Bruin <jmdebruin@xxxxxxxxx>
Reported-by: Ondrej Zary <linux@xxxxxxxxxxxxxxxxxxxx>
Reported-by: Toralf Foerster <toralf.foerster@xxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx>	[3.4.x]
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 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 <khlebnikov@xxxxxxxxxx>

Patches currently in -mm which might be from khlebnikov@xxxxxxxxxx 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 mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux