Skip to content

Commit 712ae1c

Browse files
willdeacongregkh
authored andcommitted
iommu/arm-smmu-v3: Use WRITE_ONCE() when changing validity of an STE
[ Upstream commit d71e017 ] If, for some bizarre reason, the compiler decided to split up the write of STE DWORD 0, we could end up making a partial structure valid. Although this probably won't happen, follow the example of the context-descriptor code and use WRITE_ONCE() to ensure atomicity of the write. Reported-by: Jean-Philippe Brucker <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent c2ddc19 commit 712ae1c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/iommu/arm-smmu-v3.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,8 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid,
11031103
}
11041104

11051105
arm_smmu_sync_ste_for_sid(smmu, sid);
1106-
dst[0] = cpu_to_le64(val);
1106+
/* See comment in arm_smmu_write_ctx_desc() */
1107+
WRITE_ONCE(dst[0], cpu_to_le64(val));
11071108
arm_smmu_sync_ste_for_sid(smmu, sid);
11081109

11091110
/* It's likely that we'll want to use the new STE soon */

0 commit comments

Comments
 (0)