x86/boot: Don't leak the module_map allocation in __start_xen()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 29 Oct 2019 13:33:21 +0000 (14:33 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 29 Oct 2019 13:33:21 +0000 (14:33 +0100)
commit28ed7a571fc60e5cae89031b267c1b83bbd9bddd
tree52c5b2bd9af68b79f1a1b25b53075cf1b49fd095
parent527e324dbb35e5c1d5e747520a54e957b8acfa90
x86/boot: Don't leak the module_map allocation in __start_xen()

Ever since its introducion in c/s 436fb462 "x86/microcode: enable boot
time (pre-Dom0) loading", the allocation has gone un-freed, and has its final
use as part of constructing dom0.

Xen already consideres it an error to have more than a single unaccounted-for
module (again, logic from the same change), and will only pass the first one
to dom0 as the initrd.

Instead of having an 8 byte pointer to a bitmap which won't exceed 4 bits wide
in any production scenario (dom0 kernel, initrd, XSM blob and microcode blob),
allocate module_map[] on the stack and add a sanity bound for mbi->mods_count.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
master commit: 9b757bdc1794d012f5d784de54d5884e425622e0
master date: 2019-05-13 10:35:37 +0100
xen/arch/x86/setup.c