From patchwork Fri Jul 1 05:39:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WW9uZyBXdSAo5ZC05YuHKQ==?= X-Patchwork-Id: 12902733 Return-Path: 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 E9D94C433EF for ; Fri, 1 Jul 2022 05:51:36 +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: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:In-Reply-To:References: List-Owner; bh=4cNyWpLPRKbK6wAr5j/OqZFhfIxf88/1PT33RoSVj3o=; b=dvoqaQ5KuZ5518 Fmh4JU2llLmZ/uNlBG5TN0sHGmdBCK5BbjxFhMPAH4BgGekvbgcMiD7EIQq0z1NI/gPQcJtmTn4NF 3bmyWrw6+5CkT6ow1K/2UJFefuRVxxPT+jgzvnaF60RzEwcruE1g/VR6M6a5R4jtjoAN/k77aTV4q 2V4X/d4+ccj6nNDWwNqu2uWWc42z8mIqjLMm/zopusIKmPdYp7O6MeaoPj2biq3A6Klt+VsemfGn7 R+/Y3t7FDCsSkPD2wxpqW7cCy9UzEyXZ3vB7phVzl2K7R+vAy9EIBJL8wlYKbArnHcRMAvsDqodZW thYwmSBsKn1p8RLGrYSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o79YA-0032by-JS; Fri, 01 Jul 2022 05:50:42 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o79Xv-0032X6-Vn; Fri, 01 Jul 2022 05:50:29 +0000 X-UUID: 50a285c1bffa4177bb199944bf5c8c62-20220630 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.7,REQID:c59cd871-3d20-440d-a234-c99de348094d,OB:0,LO B:0,IP:0,URL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,RULE:Release_Ham,ACT ION:release,TS:-5 X-CID-META: VersionHash:87442a2,CLOUDID:5bca2163-0b3f-4b2c-b3a6-ed5c044366a0,C OID:IGNORED,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,URL:1,File:nil ,QS:nil,BEC:nil,COL:0 X-UUID: 50a285c1bffa4177bb199944bf5c8c62-20220630 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2121834234; Thu, 30 Jun 2022 22:50:20 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Fri, 1 Jul 2022 13:39:46 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 1 Jul 2022 13:39:45 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Will Deacon CC: , , , , , Yong Wu , AngeloGioacchino Del Regno , , , , , , , , Guenter Roeck , Dan Carpenter Subject: [PATCH v3 0/7] iommu/mediatek: Improve safety from invalid dts input Date: Fri, 1 Jul 2022 13:39:35 +0800 Message-ID: <20220701053942.3266-1-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220630_225028_049058_E56E608B X-CRM114-Status: UNSURE ( 7.32 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patchset contains misc improve patches. Mainly to improve safety from invalid dts input. Change notes: v3: a) Add platform_device_put from Robin. b) Use component_match_add instead component_match_add_release suggested from Robin. v2: https://lore.kernel.org/linux-mediatek/20220616054203.11365-1-yong.wu@mediatek.com/ a) Rebase on v5.19-rc1. b) Add a New patch [5/5] just remove a variable that only is for v1. v1: https://lore.kernel.org/linux-mediatek/20220511064920.18455-1-yong.wu@mediatek.com/ Base on linux-next-20220510. the improve safety from dts is base on: https://lore.kernel.org/linux-mediatek/20211210205704.1664928-1-linux@roeck-us.net/ Guenter Roeck (1): iommu/mediatek: Validate number of phandles associated with "mediatek,larbs" Yong Wu (6): iommu/mediatek: Use dev_err_probe to mute probe_defer err log iommu/mediatek: Remove unused "mapping" member from mtk_iommu_data iommu/mediatek: Add platform_device_put for recovering the device refcnt iommu/mediatek: Use component_match_add iommu/mediatek: Add error path for loop of mm_dts_parse iommu/mediatek: Improve safety for mediatek,smi property in larb nodes drivers/iommu/mtk_iommu.c | 117 +++++++++++++++++++++++++++----------- 1 file changed, 84 insertions(+), 33 deletions(-)