Message ID | 1488198626-1884-2-git-send-email-olekstysh@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AE8D960453 for <patchwork-linux-arm@patchwork.kernel.org>; Mon, 27 Feb 2017 12:32:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A16D52811E for <patchwork-linux-arm@patchwork.kernel.org>; Mon, 27 Feb 2017 12:32:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D2E028178; Mon, 27 Feb 2017 12:32:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 487572811E for <patchwork-linux-arm@patchwork.kernel.org>; Mon, 27 Feb 2017 12:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=+VHKHByGimdTKF6pyDCgQ59517Xr+n/yL+RDxWM80mk=; b=RIFsbTp3+Xl38tGFL+8oToBb6k lpKc/IbvVbbKsHtxDllnNluNp2u3FurKrPApPOuCLRDSoU/azXsV5Sy+ANL+ql5UxY4wLx093lW+C +/dmpFwAL22CjM7ia7OLOO1kpsfg9z1yMpDlW2MNVz6K5uBQM119vscMLwm34DkzNoNDOVjd4IpCm 7n8vqaQndPxhQLpasKKKnFw2ZYjxwNFj7coVxfjX5CnWN4Rzc2wAOv8Qt9kOiHuCnhKv1JJkFQ7De UhRnGOb1yIirYp2eYLabuKBIcYmXWR0gBOc6AcyZ67ovXq1GiLDcjIUCKKEuVJKyJLWPALSq/WELG V+TJNQRg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ciKTI-0003LP-C1; Mon, 27 Feb 2017 12:32:08 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ciKSJ-00035D-PL for linux-arm-kernel@lists.infradead.org; Mon, 27 Feb 2017 12:31:11 +0000 Received: by mail-wm0-x242.google.com with SMTP id m70so13193904wma.1 for <linux-arm-kernel@lists.infradead.org>; Mon, 27 Feb 2017 04:30:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7dirIkAHAl4UhJxxJcyh4G3+sRBc+o7WZRuQFbzJKOw=; b=E8N6ydeArnIdJLdEeX0gSqskW4G4qbWOEqZdOF/LQt6rETLKplmBs7F/MgjYmJ148x hIWm+BadO7c7p0D393dWIzr8t4xX8Lm6cECbvTG0w1v7+KKRnmFeWIX9Hzv1p4YHMTQr L93faBb0pjxu1812GesI71PcEngg2I5NeMLwt1a+NWvb+ofhks74Pr5uqYZHmeemxGeu 1EE0H+uRAKFVGofdH2ZqnbYraaS4bJRx3FeB9u3mE8wYm4jUi6ML/j5JkvaX0u5N2F3W B9NfERSsfueXURXSAEE562jmrVq0PCxRWb990oWoKtwv+WDvk09sO1W+sHEwg6saGwmE vt+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7dirIkAHAl4UhJxxJcyh4G3+sRBc+o7WZRuQFbzJKOw=; b=uIgM+1kVQ9LkpHAI5Bfvqce1/W4kT3XlosjiT1MZqu2frPjQDi3om0w5uhbB/RXKyN REi1oHQOCLJgshrIrJeTIwLzfwcRrnLf0xocgHSR/Hf4IUOgusZS85jRANkP3bsWTSHR DoanvUzaft5suYxrzwUyz4EtL6NFVUtY0/wV4U8xhDs2X82QbNz8rLS/aoxG/ThKtbqd DyY6bz6Ps66TO0vHQkNYVfFr2c/AdeRfBrd556GCzhCWl7mA/EA4HqFo5NG6iIaKhQSk CrDRRXIyOk5O8iEc8PW4qPVpN58PJ1FkMk5u16RtWfpJqonynKtW7WEO8AvHcP3fywJ9 SBCA== X-Gm-Message-State: AMke39m+IhSJxjeS5jF+7adCTU2td9QElRHhlJBEsscFh4weNgmMHHmX/IL16FS5/v1SHw== X-Received: by 10.28.183.4 with SMTP id h4mr826363wmf.140.1488198646091; Mon, 27 Feb 2017 04:30:46 -0800 (PST) Received: from otyshchenko.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id u198sm14076008wmf.9.2017.02.27.04.30.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Feb 2017 04:30:45 -0800 (PST) From: Oleksandr Tyshchenko <olekstysh@gmail.com> To: linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org Subject: [PATCH v1 1/2] iommu/io-pgtable-arm: Check for leaf entry before dereferencing it Date: Mon, 27 Feb 2017 14:30:25 +0200 Message-Id: <1488198626-1884-2-git-send-email-olekstysh@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488198626-1884-1-git-send-email-olekstysh@gmail.com> References: <1488198626-1884-1-git-send-email-olekstysh@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170227_043107_983527_FB01764E X-CRM114-Status: GOOD ( 10.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 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> Cc: vlad.babchuk@gmail.com, joro@8bytes.org, will.deacon@arm.com, andrii.anisov@gmail.com, andr2000@gmail.com, al1img@gmail.com, robin.murphy@arm.com, joculator@gmail.com MIME-Version: 1.0 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c index feacc54..f9bc6eb 100644 --- a/drivers/iommu/io-pgtable-arm.c +++ b/drivers/iommu/io-pgtable-arm.c @@ -335,8 +335,12 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova, if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_NS) pte |= ARM_LPAE_PTE_NSTABLE; __arm_lpae_set_pte(ptep, pte, cfg); - } else { + } else if (!iopte_leaf(pte, lvl)) { cptep = iopte_deref(pte, data); + } else { + /* We require an unmap first */ + WARN_ON(!selftest_running); + return -EEXIST; } /* Rinse, repeat */