From: Jan Beulich Date: Tue, 7 Jun 2022 12:02:30 +0000 (+0200) Subject: IOMMU: make domctl handler tolerate NULL domain X-Git-Tag: archive/raspbian/4.16.2-1+rpi1^2~34^2~68 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=4cf9a7c7bdb9d544fbac81105bbc1059ba3dd932;p=xen.git IOMMU: make domctl handler tolerate NULL domain Besides the reporter's issue of hitting a NULL deref when !CONFIG_GDBSX, XEN_DOMCTL_test_assign_device can legitimately end up having NULL passed here, when the domctl was passed DOMID_INVALID. Fixes: 71e617a6b8f6 ("use is_iommu_enabled() where appropriate...") Reported-by: Cheyenne Wills Signed-off-by: Jan Beulich Reviewed-by: Paul Durrant Reviewed-by: Juergen Gross master commit: fa4d84e6dd3c3bfd23a525b75a5483d4ce15adbb master date: 2022-04-26 10:25:54 +0200 --- diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index caaba62c88..287f63fc73 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -535,7 +535,7 @@ int iommu_do_domctl( { int ret = -ENODEV; - if ( !is_iommu_enabled(d) ) + if ( !(d ? is_iommu_enabled(d) : iommu_enabled) ) return -EOPNOTSUPP; #ifdef CONFIG_HAS_PCI