From b1616045dc2fc3d28e6170164ceeef63a9f325b9 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Wed, 2 Oct 2019 13:36:59 +0200 Subject: [PATCH 1/2] IOMMU: add missing HVM check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix an unguarded d->arch.hvm access in assign_device(). Signed-off-by: Jan Beulich Reviewed-by: Roger Pau Monné Acked-by: Andrew Cooper (cherry picked from commit 41fd1009cd7416b73d745a77c24b4e8d1a296fe6) Signed-off-by: Ian Jackson --- xen/drivers/passthrough/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c index b00de243b8..ecb67ebc70 100644 --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -1371,7 +1371,8 @@ static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag) /* Prevent device assign if mem paging or mem sharing have been * enabled for this domain */ if ( unlikely(!need_iommu(d) && - (d->arch.hvm_domain.mem_sharing_enabled || + ((is_hvm_domain(d) && + d->arch.hvm_domain.mem_sharing_enabled) || d->vm_event->paging.ring_page || p2m_get_hostp2m(d)->global_logdirty)) ) return -EXDEV; -- 2.11.0