]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: drop PIO from unregistered devices
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 15 Jun 2022 15:05:06 +0000 (11:05 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 24 Jun 2022 16:53:37 +0000 (12:53 -0400)
commit8b59ed91397ff91a41cfac14feac71c71e3c6406
tree6f17260e675b1f6c80ee64fa7358293c6c071e6c
parent04d0922cd97a39ba6742aa8c7a26230cac372906
KVM: x86: drop PIO from unregistered devices

KVM protects the device list with SRCU, and therefore different calls
to kvm_io_bus_read()/kvm_io_bus_write() can very well see different
incarnations of kvm->buses.  If userspace unregisters a device while
vCPUs are running there is no well-defined result.  This patch applies
a safe fallback by returning early from emulator_pio_in_out().  This
corresponds to returning zeroes from IN, and dropping the writes on
the floor for OUT.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c