From 9831d4aa56025a235010ab8ea3626c7ba36f25e0 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Thu, 24 Nov 2022 10:49:27 -0500 Subject: [PATCH] maple_tree: Detect dead nodes in ma_data_end() 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 --- lib/maple_tree.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index a7da2f73c682..d8504912014e 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1402,6 +1402,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); -- 2.49.0