Skip to content

Commit eac0104

Browse files
jernejskjoergroedel
authored andcommitted
iommu/sun50i: Fix R/W permission check
Because driver has enum type permissions and iommu subsystem has bitmap type, we have to be careful how check for combined read and write permissions is done. In such case, we have to mask both permissions and check that both are set at the same time. Current code just masks both flags but doesn't check that both are set. In short, it always sets R/W permission, regardles if requested permissions were RO, WO or RW. Fix that. Fixes: 4100b8c ("iommu: Add Allwinner H6 IOMMU driver") Signed-off-by: Jernej Skrabec <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent cef2070 commit eac0104

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iommu/sun50i-iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ static u32 sun50i_mk_pte(phys_addr_t page, int prot)
271271
enum sun50i_iommu_aci aci;
272272
u32 flags = 0;
273273

274-
if (prot & (IOMMU_READ | IOMMU_WRITE))
274+
if ((prot & (IOMMU_READ | IOMMU_WRITE)) == (IOMMU_READ | IOMMU_WRITE))
275275
aci = SUN50I_IOMMU_ACI_RD_WR;
276276
else if (prot & IOMMU_READ)
277277
aci = SUN50I_IOMMU_ACI_RD;

0 commit comments

Comments
 (0)