[PATCH 6.6 07/28] maple_tree: make mas_erase() more robust
Yu Kuai
yukuai1 at huaweicloud.com
Thu Oct 24 13:19:48 UTC 2024
From: "Liam R. Howlett" <Liam.Howlett at oracle.com>
commit f7a59018953910032231c0a019208c4b0a4a8bc3 upstream.
mas_erase() may not deal correctly with all maple states. Make the
function more robust by ensuring the state is in one of the two acceptable
states.
Link: https://lkml.kernel.org/r/20231101171629.3612299-3-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett at oracle.com>
Cc: Peng Zhang <zhangpeng.00 at bytedance.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Yu Kuai <yukuai3 at huawei.com>
---
lib/maple_tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 9de2e3dfdfcc..e4d0df3980e0 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -6184,7 +6184,7 @@ void *mas_erase(struct ma_state *mas)
void *entry;
MA_WR_STATE(wr_mas, mas, NULL);
- if (mas_is_none(mas) || mas_is_paused(mas))
+ if (!mas_is_active(mas) || !mas_is_start(mas))
mas->node = MAS_START;
/* Retry unnecessary when holding the write lock. */
--
2.39.2
More information about the amd-gfx
mailing list