diff options
author | Vitaly Kuznetsov <[email protected]> | 2016-05-31 11:23:43 +0100 |
---|---|---|
committer | Ingo Molnar <[email protected]> | 2016-06-03 09:57:35 +0200 |
commit | 55f1ea15216a5a14c96738bd5284100a00ffa9dc (patch) | |
tree | d3632db3b2815f0cdf1c96877d64d27151dc2206 /tools/perf/util/trace-event-scripting.c | |
parent | 4340fa55298d17049e71c7a34e04647379c269f3 (diff) |
efi: Fix for_each_efi_memory_desc_in_map() for empty memmaps
Commit:
78ce248faa3c ("efi: Iterate over efi.memmap in for_each_efi_memory_desc()")
introduced a regression for systems booted with the 'noefi' kernel option.
In particular, I observed an early kernel hang in efi_find_mirror()'s
for_each_efi_memory_desc() call. As we don't have efi memmap on this
system we enter this iterator with the following parameters:
efi.memmap.map = 0, efi.memmap.map_end = 0, efi.memmap.desc_size = 28
... then for_each_efi_memory_desc_in_map() does the following comparison:
(md) <= (efi_memory_desc_t *)((m)->map_end - (m)->desc_size);
... where md = 0, (m)->map_end = 0 and (m)->desc_size = 28 but when we subtract
something from a NULL pointer wrap around happens and we end up returning
invalid pointer and crash.
Fix it by using the correct pointer arithmetics.
Signed-off-by: Vitaly Kuznetsov <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: K. Y. Srinivasan <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Mark Salter <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Fixes: 78ce248faa3c ("efi: Iterate over efi.memmap in for_each_efi_memory_desc()")
Link: http://lkml.kernel.org/r/[email protected]
[ Made the changelog more readable. ]
Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions