]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
IOMMU: avoid NULL deref in iommu_lookup_page()
authorJan Beulich <jbeulich@suse.com>
Tue, 14 May 2019 14:22:17 +0000 (16:22 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 14 May 2019 14:22:17 +0000 (16:22 +0200)
Luckily the function currently has no callers - it would have called
through NULL for both Arm and x86/AMD.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
xen/drivers/passthrough/iommu.c

index b453b32191c4c60def814aa1961a57eb99196433..0d2dacf2879c29e231cb8d5f68489ca8619b19bc 100644 (file)
@@ -409,7 +409,7 @@ int iommu_lookup_page(struct domain *d, dfn_t dfn, mfn_t *mfn,
 {
     const struct domain_iommu *hd = dom_iommu(d);
 
-    if ( !iommu_enabled || !hd->platform_ops )
+    if ( !iommu_enabled || !hd->platform_ops || !hd->platform_ops->lookup_page )
         return -EOPNOTSUPP;
 
     return hd->platform_ops->lookup_page(d, dfn, mfn, flags);