]>
Commit | Line | Data |
---|---|---|
f5ab4f51 GKH |
1 | From foo@baz Wed Aug 22 09:33:46 CEST 2018 |
2 | From: Zhenzhong Duan <zhenzhong.duan@oracle.com> | |
3 | Date: Fri, 22 Jun 2018 13:51:26 +0200 | |
4 | Subject: x86/microcode/intel: Fix memleak in save_microcode_patch() | |
5 | ||
6 | From: Zhenzhong Duan <zhenzhong.duan@oracle.com> | |
7 | ||
8 | [ Upstream commit 0218c766263e70795c5eaa17d75ed54bca350950 ] | |
9 | ||
10 | Free useless ucode_patch entry when it's replaced. | |
11 | ||
12 | [ bp: Drop the memfree_patch() two-liner. ] | |
13 | ||
14 | Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com> | |
15 | Signed-off-by: Borislav Petkov <bp@suse.de> | |
16 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> | |
17 | Cc: Srinivas REDDY Eeda <srinivas.eeda@oracle.com> | |
18 | Link: http://lkml.kernel.org/r/888102f0-fd22-459d-b090-a1bd8a00cb2b@default | |
19 | Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> | |
20 | Signed-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 |