From patchwork Tue Sep 20 06:37:27 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: 12981438 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 6FF4AECAAD8 for ; Tue, 20 Sep 2022 06:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=iaGWTg4SYXTYA4D2V3LpizC530571lHR55QkrMBlyek=; b=DJIPxXfStNDcSzUD84ntpXIbh1 jbWtRVZIQ0EYSOFvkwuA3NOzhkv5jPmmxDV4oInHyAya+uG4UM8i71p8loGfeLivZifcWXTkb6mNz BY9PoJKh895ht+2+LOn81tgZvvpipL2CtxzziArJRCJ6EWoekv1N8JGn82AeGVVBV+WrgZ0NjBc3s TPah1QKbYwIxj00k2yCiCwAG/V05nAMEoIG+9z4XzOBNEGKX17JPiocCgiuGZwoji+oy+FsbQ3FaT dMJ52Rja+j1TC3Wa3ieCZcE809Uj1AhLxJSZ1nAkSfw7gH4KYRFPxMBGzZ6/RXa3WW89R8ODpTB+L 9yZ0PPrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaWus-00145h-Pj; Tue, 20 Sep 2022 06:39:34 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaWuR-0013s7-GZ; Tue, 20 Sep 2022 06:39:09 +0000 X-UUID: b1113fb8612c4365a95904175e44dc7e-20220919 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=iaGWTg4SYXTYA4D2V3LpizC530571lHR55QkrMBlyek=; b=A1cDnnNcedwcZHRlsnP/jI97ytUQLxamSnxfse27EIcx+kemhvPTr8lBcd5+tjORUqi5HE9awwS6QYP4LnesPX1NtoVTPQ4wG+M9AmyVyZUEFFb+ZmHVRFcUF+05kq/uyghSxPklheYpMg5HSTt1P+DGXEQpPvtDvL8n+fAEJy0=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.11,REQID:130f4b0a-90e9-4ca3-87b3-206b59cc2287,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:39a5ff1,CLOUDID:5f466170-dafa-4a42-b716-cf2cd4845592,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,U RL:1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: b1113fb8612c4365a95904175e44dc7e-20220919 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 589075529; Mon, 19 Sep 2022 23:37:51 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Tue, 20 Sep 2022 14:37:41 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 20 Sep 2022 14:37:39 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Will Deacon CC: Robin Murphy , , , , , Yong Wu , AngeloGioacchino Del Regno , , , , , , , , Guenter Roeck , Dan Carpenter Subject: [PATCH v6 0/6] iommu/mediatek: Improve safety from invalid dts input Date: Tue, 20 Sep 2022 14:37:27 +0800 Message-ID: <20220920063733.21770-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-20220919_233907_594017_952AF782 X-CRM114-Status: UNSURE ( 9.04 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org This patchset contains misc improve patches. Mainly to improve safety from invalid dts input. Change notes: v6: No change code. just reword the commit message in [3/6] from Angelo. v5: https://lore.kernel.org/linux-mediatek/20220919092405.8256-1-yong.wu@mediatek.com/ a) Loop from MTK_LARB_NR_MAX in the error path from Angelo. b) Fix the redundant put_device for the error patch outside the loop from dan. v4: https://lore.kernel.org/linux-mediatek/20220824064306.21495-1-yong.wu@mediatek.com/ a) Just remove the first patch about dev_err_probe since it was merged. b) Rebase v6.0-rc1 v3: https://lore.kernel.org/linux-mediatek/20220701053942.3266-1-yong.wu@mediatek.com/ 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 (5): 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 iommu/mediatek: Remove unused "mapping" member from mtk_iommu_data drivers/iommu/mtk_iommu.c | 106 +++++++++++++++++++++++++++----------- 1 file changed, 76 insertions(+), 30 deletions(-)