]> www.infradead.org Git - users/jedix/linux-maple.git/commit
maple_tree: add RCU lock checking to rcu callback functions
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 27 Feb 2023 17:36:06 +0000 (09:36 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 5 Apr 2023 23:01:31 +0000 (16:01 -0700)
commit0741e29084ff57a8aa1fb582281682f30a7d6f8d
tree43c056dd08fcc950a913dd74d5ff60e03cfb9b99
parenta7d02ae59b7a4eee940443009b257a417619b52c
maple_tree: add RCU lock checking to rcu callback functions

Dereferencing RCU objects within the RCU callback without the RCU check
has caused lockdep to complain.  Fix the RCU dereferencing by using the
RCU callback lock to ensure the operation is safe.

Also stop creating a new lock to use for dereferencing during destruction
of the tree or subtree.  Instead, pass through a pointer to the tree that
has the lock that is held for RCU dereferencing checking.  It also does
not make sense to use the maple state in the freeing scenario as the tree
walk is a special case where the tree no longer has the normal encodings
and parent pointers.

Link: https://lkml.kernel.org/r/20230227173632.3292573-8-surenb@google.com
Fixes: 54a611b60590 ("Maple Tree: add new data structure")
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reported-by: Suren Baghdasaryan <surenb@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/maple_tree.c