]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Fix potential rcu issue
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 17 Nov 2022 19:31:38 +0000 (14:31 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 13 Dec 2022 20:11:49 +0000 (15:11 -0500)
Ensure the node isn't dead after reading the node end.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index df352f6ccc240979f2fb03b9f096e4afc579a8cc..ff28bd6d47455c4ad7474ac0d83642a0c63a3c95 100644 (file)
@@ -4654,13 +4654,13 @@ static inline void *mas_next_nentry(struct ma_state *mas,
        pivots = ma_pivots(node, type);
        slots = ma_slots(node, type);
        mas->index = mas_safe_min(mas, pivots, mas->offset);
+       count = ma_data_end(node, type, pivots, mas->max);
        if (ma_dead_node(node))
                return NULL;
 
        if (mas->index > max)
                return NULL;
 
-       count = ma_data_end(node, type, pivots, mas->max);
        if (mas->offset > count)
                return NULL;