mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 09:12:07 +00:00
maple_tree: fix mas_alloc_cyclic() second search
The first search may leave the maple state in an error state. Reset the
maple state before the second search so that the search has a chance of
executing correctly after an exhausted first search.
Link: https://lore.kernel.org/all/20241216060600.287B4C4CED0@smtp.kernel.org/
Link: https://lkml.kernel.org/r/20241216190113.1226145-2-Liam.Howlett@oracle.com
Fixes: 9b6713cc75
("maple_tree: Add mtree_alloc_cyclic()")
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: Yang Erkun <yangerkun@huawei.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Chuck Lever <chuck.lever@oracle.com> says:
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
d261e00f29
commit
c1eae189d5
@ -4346,7 +4346,6 @@ int mas_alloc_cyclic(struct ma_state *mas, unsigned long *startp,
|
||||
{
|
||||
unsigned long min = range_lo;
|
||||
int ret = 0;
|
||||
struct ma_state m = *mas;
|
||||
|
||||
range_lo = max(min, *next);
|
||||
ret = mas_empty_area(mas, range_lo, range_hi, 1);
|
||||
@ -4355,7 +4354,7 @@ int mas_alloc_cyclic(struct ma_state *mas, unsigned long *startp,
|
||||
ret = 1;
|
||||
}
|
||||
if (ret < 0 && range_lo > min) {
|
||||
*mas = m;
|
||||
mas_reset(mas);
|
||||
ret = mas_empty_area(mas, min, range_hi, 1);
|
||||
if (ret == 0)
|
||||
ret = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user