]> git.baikalelectronics.ru Git - kernel.git/commit
radix tree: Don't return retry entries from lookup
authorMatthew Wilcox <willy@infradead.org>
Thu, 6 Dec 2018 13:19:13 +0000 (08:19 -0500)
committerMatthew Wilcox <willy@infradead.org>
Thu, 6 Dec 2018 13:26:16 +0000 (08:26 -0500)
commit82ffd8d0b9e486d673b8050f14a0b39ef5537ad7
tree99b3f3e6321a16cfba84319c4a94a1aa653e68d9
parentb89798d88894129d893fb1c87f9b046f0c4978cf
radix tree: Don't return retry entries from lookup

Commit 454ecb4d56ed ("idr: Permit any valid kernel pointer to be stored")
changed the radix tree lookup so that it stops when reaching the bottom
of the tree.  However, the condition was added in the wrong place,
making it possible to return retry entries to the caller.  Reorder the
tests to check for the retry entry before checking whether we're at the
bottom of the tree.  The retry entry should never be found in the tree
root, so it's safe to defer the check until the end of the loop.

Add a regression test to the test-suite to be sure this doesn't come
back.

Fixes: 454ecb4d56ed ("idr: Permit any valid kernel pointer to be stored")
Reported-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Matthew Wilcox <willy@infradead.org>
lib/radix-tree.c
tools/testing/radix-tree/Makefile
tools/testing/radix-tree/main.c
tools/testing/radix-tree/regression.h
tools/testing/radix-tree/regression4.c [new file with mode: 0644]