Message ID | 20221013181221.3247429-4-jernej.skrabec@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9483C4332F for <linux-arm-kernel@archiver.kernel.org>; Thu, 13 Oct 2022 18:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5SMjaPZgNDpaGfkrKuXBxEFiqWGmKy36FsgCzA1emy0=; b=0AbnF5sNHXPrSc ipKu7Rn3gKS1TuAuBTdaWcWtH6LqCehZG8KofX4jW+/xVwZx2KKn4+qt9vM90cL4uxoW2qRDktzx5 vlKDTCFHj0tW4Bsx9NrnM7Ei8xCiZyLSZqn3njg3SNh5+xnMkMmB7qr1Qie86xUhCXKKIz6Zyb3t9 IpSozvayNLwoDGhEIi01dpQ7PNpdXxMkCsbpF+IM8qymCooE5Wb7LbwAZtE0LW0f7sMSKuggj5YCo VeZtNUwDp/7kSU7+kerohP6/bW+SN7tvCYEPHzRGEwSVBva20+MjjLIdJJ37kIk9DLNw2IcvqQAkh /BARc1vQyoM2IU01wzIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oj2i4-00CdSl-Mz; Thu, 13 Oct 2022 18:13:32 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oj2hT-00CdF6-7A for linux-arm-kernel@lists.infradead.org; Thu, 13 Oct 2022 18:12:57 +0000 Received: by mail-ed1-x52c.google.com with SMTP id r14so3756079edc.7 for <linux-arm-kernel@lists.infradead.org>; Thu, 13 Oct 2022 11:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t5o4hmrTo+a4A6KCBunzs3GYyFuyFvq3xuPa8kZR43M=; b=DU//SwH+JfMDyVMKNcHeLU136bnf9QlAcBT+KWFVH1q8TwC873dRzVkVcKr2u+9nNy s4WnYSjekVglH1Dqi8Q5bz1KKUstGlkGyZICaJIhtnSxPx9i4eWPCG4iyWXTFMOu80Yj JuXKwqbN5s/MaQedvEbm5oL0MF5SwXqsOSAYwgO+wM1nu4MxZk5JEX47YxnmZKq5HFWM iOQKeimAZfXCEBU0wVC/OmlYE4XV5R7pbnkFQFzZelR3uIldMiOvA3dP4qKmlcR5MWv6 vPAd8nW9lYSA7dr6TxoqTJEsvKy18NpG7B3jvYfTGmiaad+Tq72HVbY90tsQmCyC0nEC p6rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t5o4hmrTo+a4A6KCBunzs3GYyFuyFvq3xuPa8kZR43M=; b=tdK0OheJUR5sCFPMGlOJP3F8RVxafBSXYiFmS7eGXL9Z1MYQY2EFIFfmvQtrO0i/ZV fZXYjDe/C3T/G7Dgm3rfyR2JTIsxrjBegbc+ctWv3h2Pm1VZjFuiFbfp7ZoEKMso/ZjD /FEz8pArsEtpoUtx5hz6aZg1TOsrleXodc8ISXGozI2Z0jE7K/EYGwUFCKvqqjBaN0Yp H7zYVaYdUlJDzDo6CU6kNiFbXF5r01JA5yqgdPvwu1JZk/0cP3kzYmy6cEW46o4Yvnwm Bj1RLaXZsPtGHic3mX3499AFzM85+jCSQsclSln+CWCAYEdq/d2hHoRzHnNW5a4iXG1J K+Jg== X-Gm-Message-State: ACrzQf374Pl/0B58TxfHVH9KA2LoCB4gZIk35RBoYxBtlQelNs6N3DyD PwlmmDwTw+i6lsHNlr8YYbk= X-Google-Smtp-Source: AMsMyM779LnzMOJRUaV+d5Mya+59vT9EDrXNtlqV4dqAf2i/G2SCcwlVYTXuJQeHdR3GU8JloRYY6Q== X-Received: by 2002:a05:6402:350d:b0:45c:f5a2:348e with SMTP id b13-20020a056402350d00b0045cf5a2348emr895071edd.398.1665684768460; Thu, 13 Oct 2022 11:12:48 -0700 (PDT) Received: from kista.localdomain (82-149-19-102.dynamic.telemach.net. [82.149.19.102]) by smtp.gmail.com with ESMTPSA id ku15-20020a170907788f00b0078b551d2fa3sm211109ejc.103.2022.10.13.11.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 11:12:47 -0700 (PDT) From: Jernej Skrabec <jernej.skrabec@gmail.com> To: maxime@cerno.tech, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, wens@csie.org, samuel@sholland.org Cc: iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Jernej Skrabec <jernej.skrabec@gmail.com> Subject: [PATCH 3/5] iommu/sun50i: Fix R/W permission check Date: Thu, 13 Oct 2022 20:12:18 +0200 Message-Id: <20221013181221.3247429-4-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221013181221.3247429-1-jernej.skrabec@gmail.com> References: <20221013181221.3247429-1-jernej.skrabec@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221013_111255_310782_46C30554 X-CRM114-Status: GOOD ( 13.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series | iommu/sun50i: Fix various issues | expand |
diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index 38d1069cf383..135df6934a9e 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 | IOMMU_WRITE)) == (IOMMU_READ | IOMMU_WRITE)) aci = SUN50I_IOMMU_ACI_RD_WR; else if (prot & IOMMU_READ) aci = SUN50I_IOMMU_ACI_RD;
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: 4100b8c229b3 ("iommu: Add Allwinner H6 IOMMU driver") Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com> --- drivers/iommu/sun50i-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)