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 <[email protected]>
Signed-off-by: Jan Beulich <[email protected]>
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -558,7 +558,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