* [PATCH] x86/microcode/intel: Fix memleak in save_microcode_patch()
@ 2018-06-22 11:51 Borislav Petkov
0 siblings, 0 replies; only message in thread
From: Borislav Petkov @ 2018-06-22 11:51 UTC (permalink / raw)
To: X86 ML; +Cc: LKML
From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Free useless ucode_patch entry when it's replaced.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: Srinivas REDDY Eeda <srinivas.eeda@oracle.com>
Cc: x86-ml <x86@kernel.org>
Link: http://lkml.kernel.org/r/888102f0-fd22-459d-b090-a1bd8a00cb2b@default
[ Drop the memfree_patch() two-liner. ]
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kernel/cpu/microcode/intel.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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)
p = memdup_patch(data, size);
if (!p)
pr_err("Error allocating buffer %p\n", data);
- else
+ else {
list_replace(&iter->plist, &p->plist);
+ kfree(iter->data);
+ kfree(iter);
+ }
}
}
--
2.17.0.582.gccdcbd54c
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-06-22 11:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-22 11:51 [PATCH] x86/microcode/intel: Fix memleak in save_microcode_patch() Borislav Petkov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.