aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhenzhong Duan <zhenzhong.duan@oracle.com>2018-06-22 07:51:26 -0400
committerThomas Gleixner <tglx@linutronix.de>2018-06-22 08:42:59 -0400
commit0218c766263e70795c5eaa17d75ed54bca350950 (patch)
tree694a5b2e8716fe124021284f498626ad71b0be14
parentd7609f4210cb716c11abfe2bfb5997191095d00b (diff)
x86/microcode/intel: Fix memleak in save_microcode_patch()
Free useless ucode_patch entry when it's replaced. [ bp: Drop the memfree_patch() two-liner. ] Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com> Signed-off-by: Borislav Petkov <bp@suse.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Srinivas REDDY Eeda <srinivas.eeda@oracle.com> Link: http://lkml.kernel.org/r/888102f0-fd22-459d-b090-a1bd8a00cb2b@default
-rw-r--r--arch/x86/kernel/cpu/microcode/intel.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 1c2cfa0644aa..97ccf4c3b45b 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -190,8 +190,11 @@ static void save_microcode_patch(void *data, unsigned int size)
190 p = memdup_patch(data, size); 190 p = memdup_patch(data, size);
191 if (!p) 191 if (!p)
192 pr_err("Error allocating buffer %p\n", data); 192 pr_err("Error allocating buffer %p\n", data);
193 else 193 else {
194 list_replace(&iter->plist, &p->plist); 194 list_replace(&iter->plist, &p->plist);
195 kfree(iter->data);
196 kfree(iter);
197 }
195 } 198 }
196 } 199 }
197 200