[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-0218c766263e70795c5eaa17d75ed54bca350950@git.kernel.org>
Date: Fri, 22 Jun 2018 05:45:46 -0700
From: tip-bot for Zhenzhong Duan <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: mingo@...nel.org, tglx@...utronix.de, linux-kernel@...r.kernel.org,
zhenzhong.duan@...cle.com, bp@...e.de, srinivas.eeda@...cle.com,
hpa@...or.com
Subject: [tip:x86/urgent] x86/microcode/intel: Fix memleak in
save_microcode_patch()
Commit-ID: 0218c766263e70795c5eaa17d75ed54bca350950
Gitweb: https://git.kernel.org/tip/0218c766263e70795c5eaa17d75ed54bca350950
Author: Zhenzhong Duan <zhenzhong.duan@...cle.com>
AuthorDate: Fri, 22 Jun 2018 13:51:26 +0200
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Fri, 22 Jun 2018 14:42:59 +0200
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@...cle.com>
Signed-off-by: Borislav Petkov <bp@...e.de>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: Srinivas REDDY Eeda <srinivas.eeda@...cle.com>
Link: http://lkml.kernel.org/r/888102f0-fd22-459d-b090-a1bd8a00cb2b@default
---
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);
+ }
}
}
Powered by blists - more mailing lists