Skip to content

Commit

Permalink
mm/memblock.c: reversed logic in memblock_discard()
Browse files Browse the repository at this point in the history
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/[email protected]
Fixes: 3010f87 ("mm: discard memblock data later")
Signed-off-by: Pavel Tatashin <[email protected]>
Reported-by: Woody Suwalski <[email protected]>
Tested-by: Woody Suwalski <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Pavel Tatashin authored and torvalds committed Aug 25, 2017
1 parent 2b7e866 commit 91b540f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/memblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,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);
Expand Down

0 comments on commit 91b540f

Please sign in to comment.