Commit 82cd19cd authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-fixes-for-linus' of...

Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86/microcode: Fix double vfree() and remove redundant pointer checks before vfree()
parents b52e2a6d 5cdd2de0
...@@ -364,7 +364,6 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, ...@@ -364,7 +364,6 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,
/* For performance reasons, reuse mc area when possible */ /* For performance reasons, reuse mc area when possible */
if (!mc || mc_size > curr_mc_size) { if (!mc || mc_size > curr_mc_size) {
if (mc)
vfree(mc); vfree(mc);
mc = vmalloc(mc_size); mc = vmalloc(mc_size);
if (!mc) if (!mc)
...@@ -374,12 +373,10 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, ...@@ -374,12 +373,10 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,
if (get_ucode_data(mc, ucode_ptr, mc_size) || if (get_ucode_data(mc, ucode_ptr, mc_size) ||
microcode_sanity_check(mc) < 0) { microcode_sanity_check(mc) < 0) {
vfree(mc);
break; break;
} }
if (get_matching_microcode(&uci->cpu_sig, mc, new_rev)) { if (get_matching_microcode(&uci->cpu_sig, mc, new_rev)) {
if (new_mc)
vfree(new_mc); vfree(new_mc);
new_rev = mc_header.rev; new_rev = mc_header.rev;
new_mc = mc; new_mc = mc;
...@@ -390,11 +387,9 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, ...@@ -390,11 +387,9 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,
leftover -= mc_size; leftover -= mc_size;
} }
if (mc)
vfree(mc); vfree(mc);
if (leftover) { if (leftover) {
if (new_mc)
vfree(new_mc); vfree(new_mc);
state = UCODE_ERROR; state = UCODE_ERROR;
goto out; goto out;
...@@ -405,7 +400,6 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size, ...@@ -405,7 +400,6 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,
goto out; goto out;
} }
if (uci->mc)
vfree(uci->mc); vfree(uci->mc);
uci->mc = (struct microcode_intel *)new_mc; uci->mc = (struct microcode_intel *)new_mc;
......
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