]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Protect mas_prev_nentry() from dead nodes
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 24 Nov 2022 15:50:21 +0000 (10:50 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 13 Dec 2022 21:03:41 +0000 (16:03 -0500)
Don't use the pivot array before checking if the node is dead.  This is
for safe use in rcu mode.

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

index d8504912014eeb5bd0c78656a384208d862af5cd..e66ac3a0e47b2615471864a0714c5da6ff24c5d5 100644 (file)
@@ -4856,6 +4856,11 @@ retry:
                goto retry;
        }
 
+       if (offset == mt_pivots[mt])
+               pivot = mas->max;
+       else
+               pivot = pivots[offset];
+
        while (offset && ((!mas_slot(mas, slots, offset) && pivot >= limit) ||
               !pivot))
                pivot = pivots[--offset];