Skip to content

Commit 556f99a

Browse files
LuBaolujoergroedel
authored andcommitted
iommu: Extend mutex lock scope in iommu_probe_device()
Extend the scope of holding group->mutex so that it can cover the default domain check/attachment and direct mappings of reserved regions. Cc: Ashish Mhetre <[email protected]> Fixes: 211ff31 ("iommu: Fix race condition during default domain allocation") Signed-off-by: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 94aedac commit 556f99a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/iommu/iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,18 +288,19 @@ int iommu_probe_device(struct device *dev)
288288
*/
289289
mutex_lock(&group->mutex);
290290
iommu_alloc_default_domain(group, dev);
291-
mutex_unlock(&group->mutex);
292291

293292
if (group->default_domain) {
294293
ret = __iommu_attach_device(group->default_domain, dev);
295294
if (ret) {
295+
mutex_unlock(&group->mutex);
296296
iommu_group_put(group);
297297
goto err_release;
298298
}
299299
}
300300

301301
iommu_create_device_direct_mappings(group, dev);
302302

303+
mutex_unlock(&group->mutex);
303304
iommu_group_put(group);
304305

305306
if (ops->probe_finalize)

0 commit comments

Comments
 (0)