Re: [tip:x86/urgent] x86/microcode: Fix double vfree() and removeredundant pointer checks before vfree()

From: Henrique de Moraes Holschuh
Date: Mon Dec 27 2010 - 21:28:30 EST


On Mon, 27 Dec 2010, tip-bot for Jesper Juhl wrote:
> In arch/x86/kernel/microcode_intel.c::generic_load_microcode()
> we have this:
>
> while (leftover) {
> ...
> if (get_ucode_data(mc, ucode_ptr, mc_size) ||
> microcode_sanity_check(mc) < 0) {
> vfree(mc);
> break;
> }
> ...
> }
>
> if (mc)
> vfree(mc);

Which is trivial to trigger from userspace, fortunately limited to root in
any sane distro (and by default).

Please send it to -stable after it gets merged in mainline and is deemed
safe...

The Intel microcode driver will also accept a bogus microcode which has a
valid header, but all zeros for the cyphertext. This is a design defect on
the current Intel microcode format, but can be worked around by the driver
if one assumes such a cyphertext will never be valid (seems like a safe
assumption). I sure hope the processors will reject that kind of bogosity
even if the kernel doesn't and tries to upload it, though... I was not
crazy enough to try.

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/