From patchwork Mon Sep 19 09:23:59 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: 12979856 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 78168C54EE9 for ; Mon, 19 Sep 2022 09:55:34 +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=8y/jgF7S7DkPlz/qNVdLn1K+ViUtvj5B80dxyrq2UEw=; b=mdjTagBxMvRBWlioL+re7mfWOH qyOgiINMN38UcsmkqxeL5oh6XLzLM2d4rOGVJBV/6fMOcuyMR50S4Z7oyKr6Kqnsd/6mwpeUB267v STlX/lXpCtTfaLKUArr1O9WXrtx1dI16lxfKqqp501MfxKj8YVOqfWKsDvH6hO0RQp31jMipoGJBn vdIRBoxyFaqYvcBZllB4Q+ReocNB7Jyl0IEIyC6ciquLSJcrikmzzEQL+NccuTHk0jg8lCChK9e3p 6kXo98IFoU5HWYD9ExN5NjrsMcZ3eAyxn54q6uLgdQlH2RJYvNL09LSXEDz5RezhjU5aElOmfeR8S 5TM1scjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oaDUo-00B1MV-CP; Mon, 19 Sep 2022 09:55:22 +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 1oaDUJ-00B13H-LC; Mon, 19 Sep 2022 09:55:07 +0000 X-UUID: 3db3e6c6b96c4b86a3ef0b9a687b6bae-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=8y/jgF7S7DkPlz/qNVdLn1K+ViUtvj5B80dxyrq2UEw=; b=glcQnSHQKNa7LFE5LiLQoihd5Xf3xJYH6AxwWFhALJ7qhBh7ZplOEdifSdESaUwEvhmbptZadScAGwRWzZPr2H38+eHGauI+isNCOlV3u9TaCETJn90gCzbKlP4VLycSO4tmavGgKyPnwK3LyEZsaEkZ3lhxPEAnlgcUiTgjPdM=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.11,REQID:b7cd0f03-df15-46a0-82f9-6163a95331f9,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:d6c8235e-5ed4-4e28-8b00-66ed9f042fbd,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: 3db3e6c6b96c4b86a3ef0b9a687b6bae-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 1975279132; Mon, 19 Sep 2022 02:54:46 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 19 Sep 2022 17:24:11 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 19 Sep 2022 17:24:10 +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 v5 0/6] iommu/mediatek: Improve safety from invalid dts input Date: Mon, 19 Sep 2022 17:23:59 +0800 Message-ID: <20220919092405.8256-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_025451_753347_85ED1566 X-CRM114-Status: UNSURE ( 8.86 ) 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: v5: 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(-)