]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Detect dead nodes in ma_data_end()
authorLiam Howlett <Liam.Howlett@oracle.com>
Thu, 24 Nov 2022 15:49:27 +0000 (10:49 -0500)
committerLiam Howlett <Liam.Howlett@oracle.com>
Thu, 24 Nov 2022 21:07:24 +0000 (16:07 -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 Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index d72d1cba1b40d642fb27ef51fb5d22f78e658c04..de6fb61bb63b29ddbe375d2c4e34ece593c53916 100644 (file)
@@ -1409,6 +1409,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);