]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.67/x86-microcode-intel-fix-memleak-in-save_microcode_patch.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.67 / x86-microcode-intel-fix-memleak-in-save_microcode_patch.patch
CommitLineData
f5ab4f51
GKH
1From foo@baz Wed Aug 22 09:33:46 CEST 2018
2From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
3Date: Fri, 22 Jun 2018 13:51:26 +0200
4Subject: x86/microcode/intel: Fix memleak in save_microcode_patch()
5
6From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
7
8[ Upstream commit 0218c766263e70795c5eaa17d75ed54bca350950 ]
9
10Free useless ucode_patch entry when it's replaced.
11
12[ bp: Drop the memfree_patch() two-liner. ]
13
14Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
15Signed-off-by: Borislav Petkov <bp@suse.de>
16Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
17Cc: Srinivas REDDY Eeda <srinivas.eeda@oracle.com>
18Link: http://lkml.kernel.org/r/888102f0-fd22-459d-b090-a1bd8a00cb2b@default
19Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
20Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21---
22 arch/x86/kernel/cpu/microcode/intel.c | 5 ++++-
23 1 file changed, 4 insertions(+), 1 deletion(-)
24
25--- a/arch/x86/kernel/cpu/microcode/intel.c
26+++ b/arch/x86/kernel/cpu/microcode/intel.c
27@@ -190,8 +190,11 @@ static void save_microcode_patch(void *d
28 p = memdup_patch(data, size);
29 if (!p)
30 pr_err("Error allocating buffer %p\n", data);
31- else
32+ else {
33 list_replace(&iter->plist, &p->plist);
34+ kfree(iter->data);
35+ kfree(iter);
36+ }
37 }
38 }
39