mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 10:31:33 -04:00
md/md-llbitmap: clamp state-machine walks to tracked bits
llbitmap_state_machine() can be called with an end bit beyond llbitmap->chunks. In particular, llbitmap_cond_end_sync() passes sector >> chunkshift, and sector can reach the tracked boundary exactly. Clamp the state-machine range to llbitmap->chunks so it cannot walk past the tracked bitmap. Tested-by: Mykola Marzhan <mykola@meshstor.io> Link: https://patch.msgid.link/20260802195038.164272-23-yukuai@kernel.org Signed-off-by: Yu Kuai <yukuai@fygo.io>
This commit is contained in:
@@ -1012,7 +1012,10 @@ static enum llbitmap_state llbitmap_state_machine(struct llbitmap *llbitmap,
|
||||
llbitmap_init_state(llbitmap);
|
||||
return BitNone;
|
||||
}
|
||||
|
||||
if (start >= llbitmap->chunks)
|
||||
return BitNone;
|
||||
if (end >= llbitmap->chunks)
|
||||
end = llbitmap->chunks - 1;
|
||||
while (start <= end) {
|
||||
enum llbitmap_state c = llbitmap_read(llbitmap, start);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user