Message ID | 20221025165415.307591-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 BB6B7FA373F for <linux-arm-kernel@archiver.kernel.org>; Tue, 25 Oct 2022 16:56:25 +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=W32k+P/7yk8k0hoo9tab0XZLhh+l9gnHv1EgChhgcOg=; b=PBoQm4SJkS7f8b kMECo5ac2WlHO71jO9p/zU/hJgskJrzM7d4SRVyMyZPSZErCrO9GQH56VzxxtO5hg2vPG2J5zjHgI kIywxM8tdY6H6xiIgdUX3TxaXfucm7KUM+xd39KXs2JNmGqWfmobCcPus5HLBGN6cpnoV7Hxxt7SJ AUF7g7aZXznugKk63uFtxAWQDKbUQSdSiz6TSlzI0MQ5SzdGAdlL2OuePJZnyja9gtSiMD2McXXWQ x9Bh5rroU+x5Mbt4OCBoQXlwWzLgbh3qUI29wy+uNRx7BRN7ZAxTtzampFHZJzMpkzxUGaiOHbHPz Y3cxY6LMemZjIoq8bmwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1onNCw-006MCo-09; Tue, 25 Oct 2022 16:55:18 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1onNCK-006Lz0-Eq for linux-arm-kernel@lists.infradead.org; Tue, 25 Oct 2022 16:54:41 +0000 Received: by mail-wr1-x430.google.com with SMTP id l14so14905976wrw.2 for <linux-arm-kernel@lists.infradead.org>; Tue, 25 Oct 2022 09:54:38 -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=Q3Fgy6ar1zYHVJgyinsGrfKVrX6mZaQbt8q/dXIx19k=; b=KxaheGRKnwqkzce0a2Zgx3U/pr8SwK/9NCPKKP5oFz0u5wQGk3AnnzyNdNH1vzKhNt aS38eOd7IygJ3U6NfjWm/4uSFbulrRqvzT66xYqDXJ1C2kaZH/65eWYUyeq5/VoJk2er I8ZYKO4NQ2QVVFvqc3WEE7Cg2xbbCQ/j/kMoyQre2PvipucNkplMtMdibxfa+uN7z36i /rOnVYYfwtclXaARGXp04ftjtb/U8N9lmTzZB4B3hHLUQvFH+YlrGcmgvRZjgKk/wNLX Y5ezx5boqZGMzV/tVSb8P9hlXVS/CphlLNvdyHdjOh/7KSz3pBv32zfQCxzVrkWZzlnB B7qw== 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=Q3Fgy6ar1zYHVJgyinsGrfKVrX6mZaQbt8q/dXIx19k=; b=ZdtYdWWD3GBqgt3VjI7iuB5fEiNYxN+w1in/vkYmk+7F8s3L8GVH48pjCNuVTy548i qXtad7Kwj4uaPjLgRCQjxtZP3kwfJQRIKeNqx1gc0sflPX6fbqwZXKaEvcE5XfHrbjel ZiQEsvv66hCmmlzMUujmJ2s8eBS/x/owB5WFT1EihazZosfO7vnXXFoiFLgL2f48dEgX rT2tls1iqQS+ONp73z8dEgFQ4AgZcAjgLKx7uc/hbm44enDzXv1wO495d5gfDK/QbJxP 9Q9BMTNUaS1AYu4yQntpD5pdB+lIN6+xMbJ2382MN6VFO9iysu9Kar2m02jIUJaqIjvK kEFg== X-Gm-Message-State: ACrzQf0esp9v+fUfxJzis9sLAi+fsLkLX+NnfcFkMYsmJhIPmSzNuco7 VvwJnA1cGbhxQUOgOkBVeqc= X-Google-Smtp-Source: AMsMyM4mnIoUAmW2Rq4/080WHIpzCDO/JXtDEmGAjFfYXWF/GvrKNswK4DUiHI4n8ZHXPJLxCkaG+Q== X-Received: by 2002:adf:e484:0:b0:236:6a2e:154e with SMTP id i4-20020adfe484000000b002366a2e154emr9844814wrm.664.1666716876981; Tue, 25 Oct 2022 09:54:36 -0700 (PDT) Received: from kista.localdomain (82-149-19-102.dynamic.telemach.net. [82.149.19.102]) by smtp.gmail.com with ESMTPSA id a20-20020a05600c349400b003a6a3595edasm3023989wmq.27.2022.10.25.09.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 09:54:36 -0700 (PDT) From: Jernej Skrabec <jernej.skrabec@gmail.com> To: maxime@cerno.tech, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com Cc: wens@csie.org, samuel@sholland.org, 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 v2 3/5] iommu/sun50i: Fix R/W permission check Date: Tue, 25 Oct 2022 18:54:13 +0200 Message-Id: <20221025165415.307591-4-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221025165415.307591-1-jernej.skrabec@gmail.com> References: <20221025165415.307591-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-20221025_095440_573447_D3C1725F X-CRM114-Status: GOOD ( 13.82 ) 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 fixes | expand |
diff --git a/drivers/iommu/sun50i-iommu.c b/drivers/iommu/sun50i-iommu.c index bbc269500800..df871af04bcb 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(-)