Since user could change default domain type of an iommu group through sysfs, reading the default domain type now requires taking the lock first.
Cc: Christoph Hellwig <h...@lst.de> Cc: Joerg Roedel <j...@8bytes.org> Cc: Ashok Raj <ashok....@intel.com> Cc: Will Deacon <will.dea...@arm.com> Cc: Lu Baolu <baolu...@linux.intel.com> Cc: Sohil Mehta <sohil.me...@intel.com> Cc: Robin Murphy <robin.mur...@arm.com> Cc: Jacob Pan <jacob.jun....@linux.intel.com> Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com> --- drivers/iommu/iommu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 56a29076871f..10e14cb9c32b 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -424,6 +424,7 @@ static ssize_t iommu_group_show_type(struct iommu_group *group, { char *type = "unknown\n"; + mutex_lock(&group->mutex); if (group->default_domain) { switch (group->default_domain->type) { case IOMMU_DOMAIN_BLOCKED: @@ -440,6 +441,7 @@ static ssize_t iommu_group_show_type(struct iommu_group *group, break; } } + mutex_unlock(&group->mutex); strcpy(buf, type); return strlen(type); -- 2.7.4 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu