From: Michael Zhivich Date: Wed, 23 Jul 2025 13:40:19 +0000 (-0400) Subject: x86/bugs: Fix use of possibly uninit value in amd_check_tsa_microcode() X-Git-Tag: archive/raspbian/6.1.147-1+rpi1^2~57 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e6566b359b3a2284199b4958ec62cbc7cdc06f02;p=linux.git x86/bugs: Fix use of possibly uninit value in amd_check_tsa_microcode() Origin: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit?id=ab2c2b383f0b1a2a37d06219952f59ed0e88fa02 For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved field in zen_patch_rev union on the stack may be garbage. If so, it will prevent correct microcode check when consulting p.ucode_rev, resulting in incorrect mitigation selection. This is a stable-only fix. Cc: Signed-off-by: Michael Zhivich Fixes: d12145e8454f ("x86/bugs: Add a Transient Scheduler Attacks mitigation") Signed-off-by: Greg Kroah-Hartman Gbp-Pq: Topic bugfix/x86 Gbp-Pq: Name x86-bugs-Fix-use-of-possibly-uninit-value-in-amd_che.patch --- diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 4785d41558d..2d71c329b34 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -563,6 +563,8 @@ static bool amd_check_tsa_microcode(void) p.model = c->x86_model; p.ext_model = c->x86_model >> 4; p.stepping = c->x86_stepping; + /* reserved bits are expected to be 0 in test below */ + p.__reserved = 0; if (c->x86 == 0x19) { switch (p.ucode_rev >> 8) {