]> git.baikalelectronics.ru Git - kernel.git/commit
maple_tree: fix mas_empty_area_rev() lower bound validation
authorLiam Howlett <liam.howlett@oracle.com>
Wed, 11 Jan 2023 20:02:07 +0000 (20:02 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:23 +0000 (11:28 +0100)
commitadcf907021ca1ce3a897c70d5dbe0e6991ee0c5e
tree5b83d180b2311b329b248e0f994073bb6f7034bc
parent56ca118d34c680c976278cb048aa8031142d6b9b
maple_tree: fix mas_empty_area_rev() lower bound validation

commit 40a631f55fd235e64758bc6b6e598f81bffb23a7 upstream.

mas_empty_area_rev() was not correctly validating the start of a gap
against the lower limit.  This could lead to the range starting lower than
the requested minimum.

Fix the issue by better validating a gap once one is found.

This commit also adds tests to the maple tree test suite for this issue
and tests the mas_empty_area() function for similar bound checking.

Link: https://lkml.kernel.org/r/20230111200136.1851322-1-Liam.Howlett@oracle.com
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216911
Fixes: 58fd9cdb825e ("Maple Tree: add new data structure")
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reported-by: <amanieu@gmail.com>
Link: https://lore.kernel.org/linux-mm/0b9f5425-08d4-8013-aa4c-e620c3b10bb2@leemhuis.info/
Tested-by: Holger Hoffsttte <holger@applied-asynchrony.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/maple_tree.c
lib/test_maple_tree.c