Commit 1fbe23e0 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge tag 'microcode_fixes_for-3.21' of...

Merge tag 'microcode_fixes_for-3.21' of git://

 into x86/urgent

Pull microcode fixes from Borislav Petkov:

  - Two fixes hardening microcode data handling. (Quentin Casasnovas)
Signed-off-by: default avatarIngo Molnar <>
parents a267b0a3 35a9ff4e
......@@ -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");
if (get_ucode_data(&mc_header, ucode_ptr, sizeof(mc_header)))
......@@ -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))
mc_header = (struct microcode_header_intel *)ucode_ptr;
mc_size = get_totalsize(mc_header);
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