]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: lock slots_lock around device assignment
authorAlex Williamson <alex.williamson@redhat.com>
Wed, 18 Apr 2012 03:46:44 +0000 (21:46 -0600)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Tue, 19 Jun 2012 10:00:24 +0000 (03:00 -0700)
commitbb46421babf101754fa60bd022d0e5e99e2059dd
treed34e63c3ba3515a57f65bb709a9127e135913ed6
parent143b0488a302d43d5caf8bdbff505e5db78778fb
KVM: lock slots_lock around device assignment

Bugdb: 13966
As pointed out by Jason Baron, when assigning a device to a guest
we first set the iommu domain pointer, which enables mapping
and unmapping of memory slots to the iommu.  This leaves a window
where this path is enabled, but we haven't synchronized the iommu
mappings to the existing memory slots.  Thus a slot being removed
at that point could send us down unexpected code paths removing
non-existent pinnings and iommu mappings.  Take the slots_lock
around creating the iommu domain and initial mappings as well as
around iommu teardown to avoid this race.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This fixes: CVE-2012-2121
Conflicts:

virt/kvm/iommu.c
virt/kvm/iommu.c