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

[PATCH] IOMMU: make domctl handler tolerate NULL domain


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 19 Apr 2022 11:39:06 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8IB4UsuGr6nOaXGYqGr/XjpHpdc46ZSgT5vo4vAcxZc=; b=aACtUyXWtZJNOSYXjfSUjhhnTdxAzdh8mmA18jDnC2CZNdHDpcdjRqlHGcwlwHvpHBIP0DpObteM4uud3owc1+Uz4f9GmSGDE/hwba2ALsd0aEzB2gcqDYxG/LzpUEnQpjpVzMiZOf2RYwUdzRdap7Srsq8i3fTlKP+WsiRC0oJS4oPjbS6nFbJnKGYPYxuk5ROAbAzdV93YvrRHcA/b11rdZDcve14nIUGDYKETsc5ECya9zJKLMTBoU2QltKuBks66ksAPTZK5qr7ylV52kBHp09mwbtqvP4kr4OSf7NAHYHtYr7bve4cdzoOj9/9j6oLyybZxKaOghRy+hqR0Ww==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=StD1eZnyjb8BemLR6ngAYb6foIajHvliufCCoquI+mvgBgebV/imiRAQrUfJciXl8RNCr+QN/CkHcWAtsVEdTWITL3euEuFpkCAktEZB4BQgFSBXLuRXV+JcS7WFW3GejnESNnnJeZQzZEE+Eb6shopfw2QEAaMYTbl9Kf7Cb88RME4K6hYFc7L0W/00zt7534w/ZX+/2i/U+mr82WpAKr92cRdMaccqGK+yZ6iXEog2JO1v3Px931LVypPf/Idy+fappN2uuXIBPJnHmVxns9Ilj0Yqd0Gm0Bf4HUNooa3kWv5i/MBoCN9m4PKyDSW30HBPepPW9wFN8LXMyLEmJA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Tue, 19 Apr 2022 09:39:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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>

--- 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




 


Rackspace

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