ARM: mm: Free memblock from free_initrd_mem()
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 7 Jan 2021 09:09:20 +0000 (18:09 +0900)
committerHoegeun Kwon <hoegeun.kwon@samsung.com>
Mon, 7 Feb 2022 08:01:41 +0000 (17:01 +0900)
Even after free_initrd_mem(), memblock for initrd remains. Free
memblock for initrd from free_initrd_mem().

Reported-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
[sw0312.kim: port mainline posted patch to 5.4.y]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I42a7461558868cdfdc559959112c81bc4c8b10c5

arch/arm/mm/init.c

index 15af4dd..44f3f2e 100644 (file)
@@ -625,6 +625,12 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
+       unsigned long aligned_start, aligned_end;
+
+       aligned_start = __virt_to_phys(start) & PAGE_MASK;
+       aligned_end = PAGE_ALIGN(__virt_to_phys(end));
+       memblock_free(aligned_start, aligned_end - aligned_start);
+
        if (start == initrd_start)
                start = round_down(start, PAGE_SIZE);
        if (end == initrd_end)