> kimage_free_cma() relies on image->nr_segments to iterate over segments. > When an architecture loader (e.g., arm64) truncates nr_segments on a > mid-way failure, CMA pages allocated beyond the new boundary become > unreachable, causing silent memory leaks. > > Extract the per-segment freeing logic into the exported helper > kexec_free_segment_cma(), so that architecture loaders can release > individual segments before nr_segments is truncated. Refactor > kimage_free_cma() to loop over the new helper, preserving existing > behavior. > > Cc: Andrew Morton <[email protected]> > Cc: Baoquan He <[email protected]> > Cc: Mike Rapoport <[email protected]> > Cc: Pasha Tatashin <[email protected]> > Cc: Pratyush Yadav <[email protected]> > Cc: Breno Leitao <[email protected]> > Signed-off-by: Jinjie Ruan <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=3
