From: Liam R. Howlett Date: Thu, 24 Nov 2022 15:49:27 +0000 (-0500) Subject: maple_tree: Detect dead nodes in ma_data_end() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2a2ce469b75086d1c80ccd23d213fb539b3728c4;p=users%2Fjedix%2Flinux-maple.git 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 --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index c5bbd2a07228..b254b8169694 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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);