diff options
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/x86/kernel/microcode_intel.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c index dcb65cc0a053..1a1b606d3e92 100644 --- a/arch/x86/kernel/microcode_intel.c +++ b/arch/x86/kernel/microcode_intel.c | |||
| @@ -364,8 +364,7 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
| 364 | 364 | ||
| 365 | /* For performance reasons, reuse mc area when possible */ | 365 | /* For performance reasons, reuse mc area when possible */ |
| 366 | if (!mc || mc_size > curr_mc_size) { | 366 | if (!mc || mc_size > curr_mc_size) { |
| 367 | if (mc) | 367 | vfree(mc); |
| 368 | vfree(mc); | ||
| 369 | mc = vmalloc(mc_size); | 368 | mc = vmalloc(mc_size); |
| 370 | if (!mc) | 369 | if (!mc) |
| 371 | break; | 370 | break; |
| @@ -374,13 +373,11 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
| 374 | 373 | ||
| 375 | if (get_ucode_data(mc, ucode_ptr, mc_size) || | 374 | if (get_ucode_data(mc, ucode_ptr, mc_size) || |
| 376 | microcode_sanity_check(mc) < 0) { | 375 | microcode_sanity_check(mc) < 0) { |
| 377 | vfree(mc); | ||
| 378 | break; | 376 | break; |
| 379 | } | 377 | } |
| 380 | 378 | ||
| 381 | if (get_matching_microcode(&uci->cpu_sig, mc, new_rev)) { | 379 | if (get_matching_microcode(&uci->cpu_sig, mc, new_rev)) { |
| 382 | if (new_mc) | 380 | vfree(new_mc); |
| 383 | vfree(new_mc); | ||
| 384 | new_rev = mc_header.rev; | 381 | new_rev = mc_header.rev; |
| 385 | new_mc = mc; | 382 | new_mc = mc; |
| 386 | mc = NULL; /* trigger new vmalloc */ | 383 | mc = NULL; /* trigger new vmalloc */ |
| @@ -390,12 +387,10 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
| 390 | leftover -= mc_size; | 387 | leftover -= mc_size; |
| 391 | } | 388 | } |
| 392 | 389 | ||
| 393 | if (mc) | 390 | vfree(mc); |
| 394 | vfree(mc); | ||
| 395 | 391 | ||
| 396 | if (leftover) { | 392 | if (leftover) { |
| 397 | if (new_mc) | 393 | vfree(new_mc); |
| 398 | vfree(new_mc); | ||
| 399 | state = UCODE_ERROR; | 394 | state = UCODE_ERROR; |
| 400 | goto out; | 395 | goto out; |
| 401 | } | 396 | } |
| @@ -405,8 +400,7 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, | |||
| 405 | goto out; | 400 | goto out; |
| 406 | } | 401 | } |
| 407 | 402 | ||
| 408 | if (uci->mc) | 403 | vfree(uci->mc); |
| 409 | vfree(uci->mc); | ||
| 410 | uci->mc = (struct microcode_intel *)new_mc; | 404 | uci->mc = (struct microcode_intel *)new_mc; |
| 411 | 405 | ||
| 412 | pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n", | 406 | pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n", |
