summaryrefslogtreecommitdiff
path: root/lib/maple_tree.c
diff options
context:
space:
mode:
authorLiam R. Howlett <Liam.Howlett@oracle.com>2023-11-01 13:16:19 -0400
committerAndrew Morton <akpm@linux-foundation.org>2023-12-12 10:56:57 -0800
commitf7a59018953910032231c0a019208c4b0a4a8bc3 (patch)
tree6f445dde3565f424ac7c65cae67ce187c3d775b5 /lib/maple_tree.c
parent37a8ab24d3d4c465b070bd704e2ad2fa277df9d7 (diff)
maple_tree: make mas_erase() more robust
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@oracle.com> Cc: Peng Zhang <zhangpeng.00@bytedance.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'lib/maple_tree.c')
-rw-r--r--lib/maple_tree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index fff94a510fa8..8d379d34ea0a 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -6173,7 +6173,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. */