KVM: Remove CREATE_IRQCHIP/SET_PIT2 race
authorSteve Rutherford <srutherford@google.com>
Thu, 16 Apr 2020 19:11:52 +0000 (12:11 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 17 Apr 2020 15:04:01 +0000 (11:04 -0400)
commit7289fdb5dcdbc5155b5531529c44105868a762f2
tree3c8061ee42878e133b11a298ed7e53afc8a2c53c
parent56a87e5d997b722acf2a5dd5c938d574d8c95da6
KVM: Remove CREATE_IRQCHIP/SET_PIT2 race

Fixes a NULL pointer dereference, caused by the PIT firing an interrupt
before the interrupt table has been initialized.

SET_PIT2 can race with the creation of the IRQchip. In particular,
if SET_PIT2 is called with a low PIT timer period (after the creation of
the IOAPIC, but before the instantiation of the irq routes), the PIT can
fire an interrupt at an uninitialized table.

Signed-off-by: Steve Rutherford <srutherford@google.com>
Signed-off-by: Jon Cargille <jcargill@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Message-Id: <20200416191152.259434-1-jcargill@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c