Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2307875rwb; Mon, 19 Sep 2022 03:11:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4iLL47fFoEBr7d4ZgB7SKMlyJmgUum51VhGV4ikbwUjB45w7V5YqE4DSrHUscQyNGwVJbn X-Received: by 2002:a17:90b:4b04:b0:203:9c4e:7cc1 with SMTP id lx4-20020a17090b4b0400b002039c4e7cc1mr1621915pjb.16.1663582265762; Mon, 19 Sep 2022 03:11:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663582265; cv=none; d=google.com; s=arc-20160816; b=V990aTpLQujOAlMK5jxuS44H9PAdAApivaTJXcYhJmMizoJBzaAMH5ga9iZD3m9hpp musnekw47MuZ4o/1Uh+l2MZ59wfeuyquijNVpCGwqWpuYAiDAh/AXAaqb7ZJhF4qpIXm P69ohi/Bk8xnrC9yCWQjqMzmSGyXl4wd74O1Tzb85cQUoa+XAq4u7mZiK/EwdPnZodTQ amOMCZkIt2MN/ov5+GsAjas9BSgLS28RShejb98fAac0eRfqNua6fNaPTtIq1OCYvVZ+ a4sb8Y/phlufFCAVj6QzlHUB+Q3iRw8qAM6ajA33FeF8m+9zupBDjCH8HeVeZ4hooi7J Y80g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=8y/jgF7S7DkPlz/qNVdLn1K+ViUtvj5B80dxyrq2UEw=; b=wknSsdsQl8wzUryExAfW6IOllwMMmobKr2BZivIEWA74M0Jp8/FFlssEfEuDMzj1xP 1sTC55ohutkJvIew2uVerUwfbHjlZ7Jj/Ic5ltbBbV2hZ0Y4+LVXZS66ZO9ElcqCldra S1xxO50gobdnWvs0uvNn3et+E5SfKCoQWbpnWfYrxz7dB3E+kSevM/4L7s9jU5vka92b OBlTBKVp1TyhDzl7krWZcl92DqwK0lQUXk3+XF7hSNldDgrGpek4+T/13Afbhxd+a7NX gb+2dfAQEvaHgsaNcQVk2OUIWSoQH2NAExF6Xg80/ZNKz7VCrHgrYRF6+1lBe65YEPFY Vg0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=glcQnSHQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j20-20020a635954000000b00434a8512567si31113950pgm.822.2022.09.19.03.10.52; Mon, 19 Sep 2022 03:11:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=glcQnSHQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230178AbiISJY0 (ORCPT + 99 others); Mon, 19 Sep 2022 05:24:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbiISJYY (ORCPT ); Mon, 19 Sep 2022 05:24:24 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63E7324F09 for ; Mon, 19 Sep 2022 02:24:17 -0700 (PDT) X-UUID: 458861fd53bd4d04a86a272d80b433f0-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:9ec3e28a-a303-4aa7-aafe-2c1cf580bdd5,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:cbc9e2f6-6e85-48d9-afd8-0504bbfe04cb,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: 458861fd53bd4d04a86a272d80b433f0-20220919 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 882201365; Mon, 19 Sep 2022 17:24:12 +0800 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 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) -- 2.18.0