* Wei Yang <richard.weiyang@xxxxxxxxx> [250207 20:26]: > On destroy, we should set each node dead. But current code miss this > when the maple tree has only the root node. > > The reason is mt_destroy_walk() leverage mte_destroy_descend() to set > node dead, but this is skipped since the only root node is a leaf. > > This patch fixes this by setting the root dead before mt_destroy_walk(). > > Fixes: 54a611b60590 ("Maple Tree: add new data structure") > Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx> > CC: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx> > Cc: <stable@xxxxxxxxxxxxxxx> > --- > lib/maple_tree.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/maple_tree.c b/lib/maple_tree.c > index 198c14dd3377..d31f0a2858f7 100644 > --- a/lib/maple_tree.c > +++ b/lib/maple_tree.c > @@ -5347,6 +5347,8 @@ static inline void mte_destroy_walk(struct maple_enode *enode, > { > struct maple_node *node = mte_to_node(enode); > > + mte_set_node_dead(enode); > + This belongs in mt_destroy_walk(). > if (mt_in_rcu(mt)) { > mt_destroy_walk(enode, mt, false); > call_rcu(&node->rcu, mt_free_walk); > -- > 2.34.1 >