]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Detect dead nodes in ma_data_end()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 24 Nov 2022 15:49:27 +0000 (10:49 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 28 Nov 2022 20:18:33 +0000 (15:18 -0500)
If there is a dead node, then don't use any of the data and just return
0.  The caller will need to validate the node is not dead before using
the returned data anyways.

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

index c5bbd2a072288f08e473bd44e4dd7d4d38b70cc5..b254b8169694cae5a13c424cb79010403f90f29d 100644 (file)
@@ -1414,6 +1414,9 @@ static inline unsigned char ma_data_end(struct maple_node *node,
 {
        unsigned char offset;
 
+       if (unlikely(ma_dead_node(node)))
+               return 0;
+
        if (type == maple_arange_64)
                return ma_meta_end(node, type);