]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
maple_tree: only root node could be deficient
authorWei Yang <richard.weiyang@gmail.com>
Wed, 13 Nov 2024 03:16:16 +0000 (03:16 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 14 Jan 2025 06:40:41 +0000 (22:40 -0800)
Each level's rightmost node should have (max == ULONG_MAX).  This means
current validation skips the right most node on each level.

Only the root node may be below the minimum data threshold.

Link: https://lkml.kernel.org/r/20241113031616.10530-4-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/maple_tree.c

index ca8ae1e1cc0a5da48cb7b79699a0c98d777dc54c..f7153ade1be5f16423f0ca073846a7f3dfa60523 100644 (file)
@@ -7556,7 +7556,7 @@ void mt_validate(struct maple_tree *mt)
                MAS_WARN_ON(&mas, mte_dead_node(mas.node));
                end = mas_data_end(&mas);
                if (MAS_WARN_ON(&mas, (end < mt_min_slot_count(mas.node)) &&
-                               (mas.max != ULONG_MAX))) {
+                               (!mte_is_root(mas.node)))) {
                        pr_err("Invalid size %u of " PTR_FMT "\n",
                               end, mas_mn(&mas));
                }