From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: akpm@linux-foundation.org, maple-tree@lists.infradead.org,
linux-mm@kvack.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/3] maple_tree: may miss to set node dead on destroy
Date: Mon, 10 Feb 2025 09:19:46 -0500 [thread overview]
Message-ID: <42meyihs3gnp3bbvn5o76tzh6h2txwquqdfur5yfpfu36gapha@rtb73qgdvfag> (raw)
In-Reply-To: <20250208011852.31434-2-richard.weiyang@gmail.com>
* Wei Yang <richard.weiyang@gmail.com> [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@gmail.com>
> CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
> Cc: <stable@vger.kernel.org>
> ---
> 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
>
next prev parent reply other threads:[~2025-02-10 14:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-08 1:18 [PATCH 0/3] " Wei Yang
2025-02-08 1:18 ` [PATCH 1/3] maple_tree: " Wei Yang
2025-02-10 14:19 ` Liam R. Howlett [this message]
2025-02-11 7:48 ` Wei Yang
2025-02-11 15:23 ` Liam R. Howlett
2025-02-12 0:26 ` Wei Yang
2025-02-08 1:18 ` [PATCH 2/3] maple_tree: restart walk on correct status Wei Yang
2025-02-10 14:20 ` Liam R. Howlett
2025-02-08 1:18 ` [PATCH 3/3] maple_tree: assert retrieving new value on a tree with only root node Wei Yang
2025-02-10 14:18 ` Liam R. Howlett
2025-02-11 8:02 ` Wei Yang
2025-02-11 15:25 ` Liam R. Howlett
2025-02-12 0:41 ` Wei Yang
2025-02-10 14:31 ` [PATCH 0/3] may miss to set node dead on destroy Liam R. Howlett
2025-02-11 8:11 ` Wei Yang
2025-02-11 15:28 ` Liam R. Howlett
2025-02-12 0:49 ` Wei Yang
2025-02-12 0:55 ` Wei Yang
2025-03-04 12:07 ` Wei Yang
2025-03-04 14:45 ` Liam R. Howlett
2025-03-05 0:32 ` Wei Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42meyihs3gnp3bbvn5o76tzh6h2txwquqdfur5yfpfu36gapha@rtb73qgdvfag \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
--cc=richard.weiyang@gmail.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox