Skip to content

Commit

Permalink
x86-64, NUMA: Don't call __pa() with invalid address in numa_reset_di…
Browse files Browse the repository at this point in the history
…stance()

Do not call __pa(numa_distance) if it was not allocated before.
Calling with invalid address triggers VIRTUAL_BUG_ON() in
__phys_addr() if CONFIG_DEBUG_VIRTUAL.

Also reported by Ingo.

 http://thread.gmane.org/gmane.linux.kernel/1101306/focus=1101785

- v2: Change to check existing path as tj requested.
- tj: Description update.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Yinghai Lu authored and Tejun Heo committed Feb 17, 2011
1 parent e23bba6 commit 2ca230b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions arch/x86/mm/numa_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,13 @@ static void __init numa_reset_distance(void)
{
size_t size;

size = numa_distance_cnt * sizeof(numa_distance[0]);
memblock_x86_free_range(__pa(numa_distance),
__pa(numa_distance) + size);
if (numa_distance_cnt) {
size = numa_distance_cnt * sizeof(numa_distance[0]);
memblock_x86_free_range(__pa(numa_distance),
__pa(numa_distance) + size);
numa_distance_cnt = 0;
}
numa_distance = NULL;
numa_distance_cnt = 0;
}

/*
Expand Down

0 comments on commit 2ca230b

Please sign in to comment.