]> 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)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 23 Mar 2023 15:54:00 +0000 (11:54 -0400)
commite8cdd832cbcb43c3f3e90dbb30d3b1d551a2d43f
tree6ed1e60bd0973c7a189db373b3e3c31cdb22d3d7
parent27aa8621029ddcd2ccabfd3dc9911c043c8e6ab3
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")
Cc: stable@vger.kernel.org
Reported-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c