The patch titled Subject: maple_tree: fix out of bounds access on mas_wr_node_walk() has been added to the -mm mm-unstable branch. Its filename is maple-tree-add-new-data-structure-fix-4.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/maple-tree-add-new-data-structure-fix-4.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Liam Howlett <liam.howlett@xxxxxxxxxx> Subject: maple_tree: fix out of bounds access on mas_wr_node_walk() Date: Wed, 13 Jul 2022 02:13:12 +0000 When walking the node, check to see if offset is within the range of pivots before reading that pivot, otherwise return the max of the node. Link: https://lkml.kernel.org/r/20220713021256.542856-1-Liam.Howlett@xxxxxxxxxx Fixes: d0aac5e48048 (Maple Tree: add new data structure) Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx> Reported-by: Yu Zhao <yuzhao@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- lib/maple_tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/lib/maple_tree.c~maple-tree-add-new-data-structure-fix-4 +++ a/lib/maple_tree.c @@ -2254,10 +2254,10 @@ static inline void mas_wr_node_walk(stru wr_mas->pivots, mas->max); offset = mas->offset; min = mas_safe_min(mas, wr_mas->pivots, offset); - max = wr_mas->pivots[offset]; if (unlikely(offset == count)) - goto max; /* may have been set to zero */ + goto max; + max = wr_mas->pivots[offset]; index = mas->index; if (unlikely(index <= max)) goto done; _ Patches currently in -mm which might be from liam.howlett@xxxxxxxxxx are android-binder-fix-lockdep-check-on-clearing-vma.patch maple-tree-add-new-data-structure-fix.patch maple-tree-add-new-data-structure-fix-2.patch maple-tree-add-new-data-structure-fix-3.patch maple-tree-add-new-data-structure-fix-4.patch lib-test_maple_tree-add-testing-for-maple-tree-fix.patch lib-test_maple_tree-add-testing-for-maple-tree-fix-2.patch mm-remove-the-vma-linked-list-fix-3.patch mm-mlock-drop-dead-code-in-count_mm_mlocked_page_nr.patch