|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XEN][PATCH v5 09/17] xen/iommu: protect iommu_add_dt_device() with dtdevs_lock
Protect iommu_add_dt_device() with dtdevs_lock to prevent concurrent access add.
Signed-off-by: Vikram Garhwal <vikram.garhwal@xxxxxxx>
Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>
---
xen/drivers/passthrough/device_tree.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/xen/drivers/passthrough/device_tree.c
b/xen/drivers/passthrough/device_tree.c
index bb4cf7784d..457df333a0 100644
--- a/xen/drivers/passthrough/device_tree.c
+++ b/xen/drivers/passthrough/device_tree.c
@@ -146,6 +146,8 @@ int iommu_add_dt_device(struct dt_device_node *np)
if ( dev_iommu_fwspec_get(dev) )
return 0;
+ spin_lock(&dtdevs_lock);
+
/*
* According to the Documentation/devicetree/bindings/iommu/iommu.txt
* from Linux.
@@ -158,7 +160,10 @@ int iommu_add_dt_device(struct dt_device_node *np)
* these callback implemented.
*/
if ( !ops->add_device || !ops->dt_xlate )
- return -EINVAL;
+ {
+ rc = -EINVAL;
+ goto fail;
+ }
if ( !dt_device_is_available(iommu_spec.np) )
break;
@@ -189,6 +194,8 @@ int iommu_add_dt_device(struct dt_device_node *np)
if ( rc < 0 )
iommu_fwspec_free(dev);
+fail:
+ spin_unlock(&dtdevs_lock);
return rc;
}
--
2.17.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |