]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Prevent starting PIT timers in the absence of irqchip support
authorJan Kiszka <jan.kiszka@siemens.com>
Wed, 14 Dec 2011 18:25:13 +0000 (19:25 +0100)
committerAvi Kivity <avi@redhat.com>
Sun, 25 Dec 2011 15:13:18 +0000 (17:13 +0200)
commitcc6a35783a8eae0859b8b6370b53aa74772072e8
tree87b23ddd025d5c44ebaa941b92c8cd8ade6af703
parentbdd075d8b64c9f6c266dfa474dd8e06628846480
KVM: x86: Prevent starting PIT timers in the absence of irqchip support

User space may create the PIT and forgets about setting up the irqchips.
In that case, firing PIT IRQs will crash the host:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000128
IP: [<ffffffffa10f6280>] kvm_set_irq+0x30/0x170 [kvm]
...
Call Trace:
 [<ffffffffa11228c1>] pit_do_work+0x51/0xd0 [kvm]
 [<ffffffff81071431>] process_one_work+0x111/0x4d0
 [<ffffffff81071bb2>] worker_thread+0x152/0x340
 [<ffffffff81075c8e>] kthread+0x7e/0x90
 [<ffffffff815a4474>] kernel_thread_helper+0x4/0x10

Prevent this by checking the irqchip mode before starting a timer. We
can't deny creating the PIT if the irqchips aren't set up yet as
current user land expects this order to work.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/i8254.c