Skip to content

Commit

Permalink
x86/microcode/AMD: Fix __apply_microcode_amd()'s return value
Browse files Browse the repository at this point in the history
When verify_sha256_digest() fails, __apply_microcode_amd() should propagate
the failure by returning false (and not -1 which is promoted to true).

Fixes: 50cef76 ("x86/microcode/AMD: Load only SHA256-checksummed patches")
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250327230503.1850368-2-boris.ostrovsky@oracle.com
  • Loading branch information
Boris Ostrovsky authored and Borislav Petkov (AMD) committed Mar 28, 2025
1 parent dc84bc2 commit 31ab12d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpu/microcode/amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ static bool __apply_microcode_amd(struct microcode_amd *mc, u32 *cur_rev,
unsigned long p_addr = (unsigned long)&mc->hdr.data_code;

if (!verify_sha256_digest(mc->hdr.patch_id, *cur_rev, (const u8 *)p_addr, psize))
return -1;
return false;

native_wrmsrl(MSR_AMD64_PATCH_LOADER, p_addr);

Expand Down

0 comments on commit 31ab12d

Please sign in to comment.