]> 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>
Mon, 28 Nov 2022 20:18:33 +0000 (15:18 -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 b254b8169694cae5a13c424cb79010403f90f29d..b846d9ccfa9bafb222adef219f8ede7e6cad0467 100644 (file)
@@ -4860,6 +4860,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];