Skip to content
Commit 987d1149 authored by Eric Biggers's avatar Eric Biggers Committed by Paolo Bonzini
Browse files

KVM: fix unregistering coalesced mmio zone from wrong bus



If you register a kvm_coalesced_mmio_zone with '.pio = 0' but then
unregister it with '.pio = 1', KVM_UNREGISTER_COALESCED_MMIO will try to
unregister it from KVM_PIO_BUS rather than KVM_MMIO_BUS, which is a
no-op.  But it frees the kvm_coalesced_mmio_dev anyway, causing a
use-after-free.

Fix it by only unregistering and freeing the zone if the correct value
of 'pio' is provided.

Reported-by: default avatar <syzbot+f87f60bb6f13f39b54e3@syzkaller.appspotmail.com>
Fixes: 0804c849

 ("kvm/x86 : add coalesced pio support")
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 7566ec39
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment