x86/microcode/AMD: Concentrate patch verification
authorBorislav Petkov <bp@suse.de>
Thu, 19 Jul 2018 13:32:42 +0000 (15:32 +0200)
committerBorislav Petkov <bp@suse.de>
Mon, 19 Nov 2018 09:51:05 +0000 (10:51 +0100)
commit2b8d34b1ece506a9bbd47b56d266ee020a0c65ac
treeff3b76052e8c87292a99aeb42a4ea3282ae16075
parent70887cb23eda6bedac73eef227b55e3eb74e0cb7
x86/microcode/AMD: Concentrate patch verification

Add a verify_patch() function which tries to sanity-check many aspects
of a microcode patch supplied by an outside container before attempting
a load.

Prepend all sub-functions' names which verify an aspect of a microcode
patch with "__".

Call it in verify_and_add_patch() *before* looking at the microcode
header.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: x86@kernel.org
Link: https://lkml.kernel.org/r/20181107170218.7596-7-bp@alien8.de
arch/x86/kernel/cpu/microcode/amd.c