xen/iommu: dt: Check the return value of xsm_deassign_dtdevice()
authorJulien Grall <jgrall@amazon.com>
Wed, 25 May 2022 08:52:38 +0000 (09:52 +0100)
committerJulien Grall <jgrall@amazon.com>
Wed, 25 May 2022 08:52:59 +0000 (09:52 +0100)
xsm_deassign_dtdevice() will indicate whether the caller is allowed
to issue the operation. So the return value has to be checked.

Spotted by clang static analyzer.

Fixes: fe36cccc483c ("xen/passthrough: Extend XEN_DOMCTL_*assign_device to support DT device")
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Michal Orzel <michal.orzel@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
xen/drivers/passthrough/device_tree.c

index 98f2aa0dad6826b3caf9a8b26a715fdd09e87015..1c32d7b50cce360250f1f0a05d5d133477f01b65 100644 (file)
@@ -269,6 +269,8 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,
             break;
 
         ret = xsm_deassign_dtdevice(XSM_HOOK, d, dt_node_full_name(dev));
+        if ( ret )
+            break;
 
         if ( d == dom_io )
             return -EINVAL;