x86/ucode/amd: Fix OoB read in cpu_request_microcode()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 5 Mar 2021 14:31:50 +0000 (15:31 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 5 Mar 2021 14:31:50 +0000 (15:31 +0100)
commitdaa4149647e1ba5ea22de346e1894ae793a17500
treeba567a4d9a421c3dd6bfd6f27a4256b87387a0bb
parent73a269624b5b6625344af97269f480c4ff426508
x86/ucode/amd: Fix OoB read in cpu_request_microcode()

verify_patch_size() is a maximum size check, and doesn't have a minimum bound.

If the microcode container encodes a blob with a length less than 64 bytes,
the subsequent calls to microcode_fits()/compare_header() may read off the end
of the buffer.

Fixes: 4de936a38a ("x86/ucode/amd: Rework parsing logic in cpu_request_microcode()")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 1cbc4d89c45cba3929f1c0cb4bca0b000c4f174b
master date: 2021-02-10 13:23:51 +0000
xen/arch/x86/cpu/microcode/amd.c