Commit 0218c766 authored by Zhenzhong Duan's avatar Zhenzhong Duan Committed by Thomas Gleixner

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: default avatarZhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Srinivas REDDY Eeda <srinivas.eeda@oracle.com>
Link: http://lkml.kernel.org/r/888102f0-fd22-459d-b090-a1bd8a00cb2b@default
parent d7609f42
...@@ -190,8 +190,11 @@ static void save_microcode_patch(void *data, unsigned int size) ...@@ -190,8 +190,11 @@ static void save_microcode_patch(void *data, unsigned int size)
p = memdup_patch(data, size); p = memdup_patch(data, size);
if (!p) if (!p)
pr_err("Error allocating buffer %p\n", data); pr_err("Error allocating buffer %p\n", data);
else else {
list_replace(&iter->plist, &p->plist); list_replace(&iter->plist, &p->plist);
kfree(iter->data);
kfree(iter);
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment