[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen stable-4.15] IOMMU: make domctl handler tolerate NULL domain



commit dc798302e7d4e55f518e10fa00d654abd6695e5c
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Jun 7 14:18:41 2022 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jun 7 14:18:41 2022 +0200

    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 <cheyenne.wills@xxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Paul Durrant <paul@xxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
    master commit: fa4d84e6dd3c3bfd23a525b75a5483d4ce15adbb
    master date: 2022-04-26 10:25:54 +0200
---
 xen/drivers/passthrough/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 98c6550a36..9a2b1e7808 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -515,7 +515,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
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.15



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.