From: David Stevens <steve...@chromium.org>

Fix RW protection check when making a pte, so that it properly checks
that both R and W flags are set, instead of either R or W.

Signed-off-by: David Stevens <steve...@chromium.org>
---
 drivers/iommu/sun50i-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c
index 181bb1c3437c..11cf5af30956 100644
--- a/drivers/iommu/sun50i-iommu.c
+++ b/drivers/iommu/sun50i-iommu.c
@@ -271,7 +271,7 @@ static u32 sun50i_mk_pte(phys_addr_t page, int prot)
        enum sun50i_iommu_aci aci;
        u32 flags = 0;
 
-       if (prot & (IOMMU_READ | IOMMU_WRITE))
+       if ((prot & IOMMU_READ) && (prot & IOMMU_WRITE))
                aci = SUN50I_IOMMU_ACI_RD_WR;
        else if (prot & IOMMU_READ)
                aci = SUN50I_IOMMU_ACI_RD;
-- 
2.32.0.402.g57bb445576-goog

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to