linux-stable/tools/testing/radix-tree
Matthew Wilcox (Oracle) ec5cf2977c XArray: Do not return sibling entries from xa_load()
commit cbc0285433 upstream.

It is possible for xa_load() to observe a sibling entry pointing to
another sibling entry.  An example:

Thread A:		Thread B:
			xa_store_range(xa, entry, 188, 191, gfp);
xa_load(xa, 191);
entry = xa_entry(xa, node, 63);
[entry is a sibling of 188]
			xa_store_range(xa, entry, 184, 191, gfp);
if (xa_is_sibling(entry))
offset = xa_to_sibling(entry);
entry = xa_entry(xas->xa, node, offset);
[entry is now a sibling of 184]

It is sufficient to go around this loop until we hit a non-sibling entry.
Sibling entries always point earlier in the node, so we are guaranteed
to terminate this search.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Fixes: 6b24ca4a1a ("mm: Use multi-index entries in the page cache")
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-09-13 09:48:39 +02:00
..
generated maple_tree: reorganize testing to restore module testing 2022-11-08 15:57:22 -08:00
linux maple_tree: add __init and __exit to test module 2023-08-03 10:25:46 +02:00
trace/events Maple Tree: add new data structure 2022-09-26 19:46:13 -07:00
.gitignore maple_tree: reorganize testing to restore module testing 2022-11-08 15:57:22 -08:00
benchmark.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
bitmap.c xarray: Add XArray unconditional store operations 2018-10-21 10:45:57 -04:00
idr-test.c idr test suite: Improve reporting from idr_find_test_1 2021-04-01 07:50:42 -04:00
iteration_check.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
iteration_check_2.c xarray: Fix early termination of xas_for_each_marked 2020-03-12 17:42:08 -04:00
linux.c maple_tree: reorganize testing to restore module testing 2022-11-08 15:57:22 -08:00
main.c xarray: Fix early termination of xas_for_each_marked 2020-03-12 17:42:08 -04:00
Makefile radix-tree: move declarations to header 2023-06-12 11:31:50 -07:00
maple.c maple_tree: add __init and __exit to test module 2023-08-03 10:25:46 +02:00
multiorder.c XArray: Do not return sibling entries from xa_load() 2023-09-13 09:48:39 +02:00
regression.h radix tree: Don't return retry entries from lookup 2018-12-06 08:26:16 -05:00
regression1.c radix tree test suite: fix incorrect allocation size for pthreads 2023-08-16 18:32:19 +02:00
regression2.c radix tree test suite: Convert tag_tagged_items to XArray 2018-10-21 10:46:45 -04:00
regression3.c page cache: Convert find_get_pages_contig to XArray 2018-10-21 10:46:34 -04:00
regression4.c radix tree: Don't return retry entries from lookup 2018-12-06 08:26:16 -05:00
tag_check.c radix tree test suite: Convert tag_tagged_items to XArray 2018-10-21 10:46:45 -04:00
test.c radix tree tests: Convert item_delete_rcu to XArray 2018-10-21 10:46:48 -04:00
test.h radix tree test suite: Fix compilation 2020-10-07 09:07:49 -04:00
xarray.c radix tree test suite: Register the main thread with the RCU library 2021-04-01 07:41:30 -04:00