Commit 1c229d7a authored by Pavel Tatashin's avatar Pavel Tatashin Committed by Greg Kroah-Hartman

mm/memblock.c: reversed logic in memblock_discard()

commit 91b540f9 upstream.

In recently introduced memblock_discard() there is a reversed logic bug.
Memory is freed of static array instead of dynamically allocated one.

Link: http://lkml.kernel.org/r/1503511441-95478-2-git-send-email-pasha.tatashin@oracle.com
Fixes: 3010f876 ("mm: discard memblock data later")
Signed-off-by: default avatarPavel Tatashin <pasha.tatashin@oracle.com>
Reported-by: default avatarWoody Suwalski <terraluna977@gmail.com>
Tested-by: default avatarWoody Suwalski <terraluna977@gmail.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f5024bb3
......@@ -302,7 +302,7 @@ void __init memblock_discard(void)
__memblock_free_late(addr, size);
}
if (memblock.memory.regions == memblock_memory_init_regions) {
if (memblock.memory.regions != memblock_memory_init_regions) {
addr = __pa(memblock.memory.regions);
size = PAGE_ALIGN(sizeof(struct memblock_region) *
memblock.memory.max);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment