Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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);
			}
		}
	}