Commit 29ad6bb
maple_tree: fix allocation in mas_sparse_area()
In the case of reverse allocation, mas->index and mas->last do not point
to the correct allocation range, which will cause users to get incorrect
allocation results, so fix it. If the user does not use it in a specific
way, this bug will not be triggered.
This is a bug, but only VMA uses it now, the way VMA is used now will
not trigger it. There is a possibility that a user will trigger it in
the future.
Also re-check whether the size is still satisfied after the lower bound
was increased, which is a corner case and is incorrect in previous
versions.
Link: https://lkml.kernel.org/r/20230419093625.99201-1-zhangpeng.00@bytedance.com
Fixes: 54a611b ("Maple Tree: add new data structure")
Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>
Cc: Liam R. Howlett <Liam.Howlett@Oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent 5315644 commit 29ad6bb
1 file changed
Lines changed: 20 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5250 | 5250 | | |
5251 | 5251 | | |
5252 | 5252 | | |
5253 | | - | |
| 5253 | + | |
5254 | 5254 | | |
5255 | 5255 | | |
5256 | | - | |
5257 | | - | |
5258 | | - | |
5259 | | - | |
| 5256 | + | |
| 5257 | + | |
| 5258 | + | |
| 5259 | + | |
| 5260 | + | |
| 5261 | + | |
| 5262 | + | |
| 5263 | + | |
| 5264 | + | |
5260 | 5265 | | |
5261 | 5266 | | |
5262 | | - | |
5263 | | - | |
5264 | | - | |
5265 | 5267 | | |
5266 | | - | |
5267 | | - | |
5268 | | - | |
| 5268 | + | |
| 5269 | + | |
| 5270 | + | |
| 5271 | + | |
| 5272 | + | |
5269 | 5273 | | |
5270 | | - | |
5271 | | - | |
| 5274 | + | |
5272 | 5275 | | |
5273 | 5276 | | |
5274 | 5277 | | |
| |||
5297 | 5300 | | |
5298 | 5301 | | |
5299 | 5302 | | |
5300 | | - | |
5301 | | - | |
5302 | | - | |
5303 | | - | |
| 5303 | + | |
| 5304 | + | |
5304 | 5305 | | |
5305 | 5306 | | |
5306 | 5307 | | |
| |||
5356 | 5357 | | |
5357 | 5358 | | |
5358 | 5359 | | |
5359 | | - | |
5360 | | - | |
5361 | | - | |
5362 | | - | |
| 5360 | + | |
| 5361 | + | |
5363 | 5362 | | |
5364 | 5363 | | |
5365 | 5364 | | |
| |||
0 commit comments