From fa29820dbc6772575958474af1a49f358ce84378 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Thu, 18 Feb 2021 09:27:48 -0500 Subject: [PATCH] lib/maple_tree: Fix mas_store_gfp() on spanning store. Spanning store detection needs to be more robust than checking if it spans the end of a node. Fix the detection by using mas_is_span_wr(). Also ensure it's not MAS_NONE. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 000b49f4f1d8..329634edd8a8 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5193,9 +5193,8 @@ void *mas_store(struct ma_state *mas, void *entry) int mas_store_gfp(struct ma_state *mas, void *entry, gfp_t gfp) { - // Detect spanning store. - if ((mas->last == mas->max && !entry) || - (mas->last > mas->max)) + if (mas_is_span_wr(mas, mas->max, mte_node_type(mas->node), entry) || + mas_is_none(mas)) mas->node = MAS_START; retry: -- 2.50.1