Skip to content

Commit

Permalink
Merge tag 'microcode_fixes_for-3.21' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Ingo Molnar committed Feb 19, 2015
2 parents a267b0a + 35a9ff4 commit 1fbe23e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions arch/x86/kernel/cpu/microcode/intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 5 additions & 1 deletion arch/x86/kernel/cpu/microcode/intel_early.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1fbe23e

Please sign in to comment.