Merge tag 'microcode_fixes_for-3.21' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp into x86/urgent
Pull microcode fixes from Borislav Petkov: - Two fixes hardening microcode data handling. (Quentin Casasnovas) Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
@@ -196,6 +196,11 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,
|
||||
struct microcode_header_intel mc_header;
|
||||
unsigned int mc_size;
|
||||
|
||||
if (leftover < sizeof(mc_header)) {
|
||||
pr_err("error! Truncated header in microcode data file\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (get_ucode_data(&mc_header, ucode_ptr, sizeof(mc_header)))
|
||||
break;
|
||||
|
||||
|
@@ -321,7 +321,11 @@ get_matching_model_microcode(int cpu, unsigned long start,
|
||||
unsigned int mc_saved_count = mc_saved_data->mc_saved_count;
|
||||
int i;
|
||||
|
||||
while (leftover) {
|
||||
while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) {
|
||||
|
||||
if (leftover < sizeof(mc_header))
|
||||
break;
|
||||
|
||||
mc_header = (struct microcode_header_intel *)ucode_ptr;
|
||||
|
||||
mc_size = get_totalsize(mc_header);
|
||||
|
Reference in New Issue
Block a user