a16a366927
commit 5c089fd0c73411f2170ab795c9ffc16718c7d007 upstream.
If the entry is deleted from the IDR between the call to
radix_tree_iter_find() and rcu_dereference_raw(), idr_get_next()
will return NULL, which will end the iteration prematurely. We should
instead continue to the next entry in the IDR. This only happens if the
iteration is protected by the RCU lock. Most IDR users use a spinlock
or semaphore to exclude simultaneous modifications. It was noticed once
the PID allocator was converted to use the IDR, as it uses the RCU lock,
but there may be other users elsewhere in the kernel.
We can't use the normal pattern of calling radix_tree_deref_retry()
(which catches both a retry entry in a leaf node and a node entry in
the root) as the IDR supports storing entries which are unaligned,
which will trigger an infinite loop if they are encountered. Instead,
we have to explicitly check whether the entry is a retry entry.
Fixes:
|
||
---|---|---|
.. | ||
generated | ||
linux | ||
.gitignore | ||
benchmark.c | ||
idr-test.c | ||
iteration_check.c | ||
linux.c | ||
main.c | ||
Makefile | ||
multiorder.c | ||
regression.h | ||
regression1.c | ||
regression2.c | ||
regression3.c | ||
tag_check.c | ||
test.c | ||
test.h |