]> 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>
Mon, 28 Nov 2022 20:18:33 +0000 (15:18 -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 f107920ca5ef2151c872ad9de8deb5a4d3f2d752..0da105a6d8a73708da607f97cee50825cb182658 100644 (file)
@@ -4651,13 +4651,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;