Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1544761

[PATCH] iommu/arm-smmu-v3: prevent corruption of ste stage-1 context ptr

From Nate Watterson <nwatters@codeaurora.org>
Newsgroups linux.kernel
Subject [PATCH] iommu/arm-smmu-v3: prevent corruption of ste stage-1 context ptr
Date 2016-12-19 21:50 +0100
Message-ID <sQd2G-4h6-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


To ensure that the stage-1 context ptr for an ste points to the
intended context descriptor, this patch adds code to clear away
the stale context ptr value prior to or'ing in the new one.

Signed-off-by: Nate Watterson <nwatters@codeaurora.org>
---
 drivers/iommu/arm-smmu-v3.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 4d6ec44..093f9f1 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -1080,6 +1080,8 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_device *smmu, u32 sid,
 		if (smmu->features & ARM_SMMU_FEAT_STALLS)
 			dst[1] |= cpu_to_le64(STRTAB_STE_1_S1STALLD);
 
+		val &= ~(STRTAB_STE_0_S1CTXPTR_MASK <<
+			 STRTAB_STE_0_S1CTXPTR_SHIFT);
 		val |= (ste->s1_cfg->cdptr_dma & STRTAB_STE_0_S1CTXPTR_MASK
 		        << STRTAB_STE_0_S1CTXPTR_SHIFT) |
 			STRTAB_STE_0_CFG_S1_TRANS;
-- 
Qualcomm Datacenter Technologies, Inc. on behalf of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux
Foundation Collaborative Project.

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] iommu/arm-smmu-v3: prevent corruption of ste stage-1 context ptr Nate Watterson <nwatters@codeaurora.org> - 2016-12-19 21:50 +0100
  Re: [PATCH] iommu/arm-smmu-v3: prevent corruption of ste stage-1  context ptr Will Deacon <will.deacon@arm.com> - 2016-12-20 11:00 +0100
    [PATCH] iommu/arm-smmu-v3: Clear prior settings when updating STEs Nate Watterson <nwatters@codeaurora.org> - 2016-12-21 05:20 +0100

csiph-web