]> 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>
Fri, 24 Mar 2023 15:18:38 +0000 (11:18 -0400)
commit401dfa4bbec8f6f4fbf74d8ea2b4195479fc8084
tree0801367d1f64ea9faa8a80a74c7425fd897efbfb
parent0e3242d07a7bbf3a9a495e118aac10f12e53438f
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