mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-18 02:04:05 +08:00
memblock: use kfree() to release kmalloced memblock regions
memblock.{reserved,memory}.regions may be allocated using kmalloc() in memblock_double_array(). Use kfree() to release these kmalloced regions. -----BEGIN PGP SIGNATURE----- iQFHBAABCAAxFiEEeOVYVaWZL5900a/pOQOGJssO/ZEFAmIZ1qgTHHJwcHRAbGlu dXguaWJtLmNvbQAKCRA5A4Ymyw79kXsaB/0TnrLt98t/jPvVGinsnf7r3hXnNq7F 8FXWqdUIBWRfiHVd74pX6VE4Be56BbMUUyRQWDfbjrluVFnBibA3qJhNmpIuwdSb 9GESikUdEnuq0t059yPLupKvYY0ysq4OjNLWage+8tnA/TzlN/+t27c75iZWwGn2 JbutM/j5YKnvAcqUVv/plLVIVrGz1RCaG0diYoY1vxrbpRCicmAI8LHTkK1Xtow2 7YVkRuQWY+yJLOJ/SCst5pxy6cm3R96KvnaC9fg1Pp+8wVFrZp/hDsH8nObFccXq 6zQTbXqS88VKOoNEcuqk2ITbFyghepPIBrliEmcI2h96OSdp6BtrNau7 =UpBU -----END PGP SIGNATURE----- Merge tag 'fixes-2022-02-26' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock Pull memblock fix from Mike Rapoport: "Use kfree() to release kmalloced memblock regions memblock.{reserved,memory}.regions may be allocated using kmalloc() in memblock_double_array(). Use kfree() to release these kmalloced regions" * tag 'fixes-2022-02-26' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock: memblock: use kfree() to release kmalloced memblock regions
This commit is contained in:
commit
e41898d2ba
@ -366,14 +366,20 @@ void __init memblock_discard(void)
|
||||
addr = __pa(memblock.reserved.regions);
|
||||
size = PAGE_ALIGN(sizeof(struct memblock_region) *
|
||||
memblock.reserved.max);
|
||||
memblock_free_late(addr, size);
|
||||
if (memblock_reserved_in_slab)
|
||||
kfree(memblock.reserved.regions);
|
||||
else
|
||||
memblock_free_late(addr, size);
|
||||
}
|
||||
|
||||
if (memblock.memory.regions != memblock_memory_init_regions) {
|
||||
addr = __pa(memblock.memory.regions);
|
||||
size = PAGE_ALIGN(sizeof(struct memblock_region) *
|
||||
memblock.memory.max);
|
||||
memblock_free_late(addr, size);
|
||||
if (memblock_memory_in_slab)
|
||||
kfree(memblock.memory.regions);
|
||||
else
|
||||
memblock_free_late(addr, size);
|
||||
}
|
||||
|
||||
memblock_memory = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user