From nobody Tue May 7 23:42:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+54767+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+54767+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1582621450; cv=none; d=zohomail.com; s=zohoarc; b=IfOvqLEuUiMgG0QQcv/dTRnh/PgLaySnFURmjV0yyJj9xY9rwAAAXNyUj4Vjb7SphcEPxeefzElKqqKcFXt0U2lSBHN6WxAv4p0N0dC0VCxMHQv7t/qLOWzdzh1QyfqJy+Zbdzm1konyMXRk4+DBY6hevZvFiCbZqEKNN9JgFuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582621450; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=/dbr6u0+Ya0hgpsDa4fC0t4oT7sa7vK44A68Ysm4Utk=; b=IdN2bNt10fmXQ6oMViZpnJCTU03vnSArQT6cpdL7vzgOFdqGkuJ7/6sM1O9zjN0stAT8N8L0sQnH2D5TGlmFQjETbN7qlNj5BLSPF6mJbnvKuwhi7KFaHnN/kdNAP9mmtne0taj0twROhKnIMgsZG7NwqeIaO7mcNUnEm9ycBdM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+54767+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1582621450747498.3648514245209; Tue, 25 Feb 2020 01:04:10 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id GBdpYY1788612xlLKoCfxDz7; Tue, 25 Feb 2020 01:04:09 -0800 X-Received: from huawei.com (huawei.com [45.249.212.32]) by mx.groups.io with SMTP id smtpd.web12.1248.1582621448113450415 for ; Tue, 25 Feb 2020 01:04:08 -0800 X-Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 6F6B2544FE40937246FC; Tue, 25 Feb 2020 17:04:04 +0800 (CST) X-Received: from linux-TFkxOR.huawei.com (10.175.104.212) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.439.0; Tue, 25 Feb 2020 17:03:46 +0800 From: "Guoheyi" To: CC: , Heyi Guo , "Lorenzo Pieralisi" , Hanjun Guo , Sudeep Holla , "Rafael J. Wysocki" , Len Brown , , , Subject: [edk2-devel] [PATCH] acpi/iort: check output reference for the real used mapping Date: Tue, 25 Feb 2020 17:01:36 +0800 Message-ID: <20200225090136.40989-1-guoheyi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.104.212] X-CFilter-Loop: Reflected Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,guoheyi@huawei.com X-Gm-Message-State: Qm1a7zgz5knqeaV6AIXq36UEx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1582621449; bh=3lvfCDkGeJaJjP3JppPWdi31tWQLU8K+BGreGmWA1Cw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=vBUiL87cr16tV2HoU35S+YLbjcvDbDwSA+W3ibb1aC9mQo0UkRT6pbMUsqooiRcKShi 5+sAsYxILJfTwq1ry56p8KLLDJ9KjJqDtHxHpZEGFmsZNySOPVqDZ3TCgmWpAyH5qij8L Hu2n0DslEuhlYidxS0XWCiBrNlOIK8yne4w= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The function iort_node_map_id() does the sanity check against the first mapping in the node, but not the one which we really use. Logically we need check the mapping we use, or check every mapping in the node. Choose the first fix for we are not firmware tester. Signed-off-by: Heyi Guo --- Cc: Lorenzo Pieralisi Cc: Hanjun Guo Cc: Sudeep Holla Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: linux-acpi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/acpi/arm64/iort.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c index ed3d2d1a7ae9..d0fe8d673240 100644 --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -470,13 +470,6 @@ static struct acpi_iort_node *iort_node_map_id(struct = acpi_iort_node *node, map =3D ACPI_ADD_PTR(struct acpi_iort_id_mapping, node, node->mapping_offset); =20 - /* Firmware bug! */ - if (!map->output_reference) { - pr_err(FW_BUG "[node %p type %d] ID map has NULL parent reference\n", - node, node->type); - goto fail_map; - } - /* * Get the special ID mapping index (if any) and skip its * associated ID map to prevent erroneous multi-stage @@ -497,6 +490,13 @@ static struct acpi_iort_node *iort_node_map_id(struct = acpi_iort_node *node, if (i =3D=3D node->mapping_count) goto fail_map; =20 + /* Firmware bug! */ + if (!map->output_reference) { + pr_err(FW_BUG "[node %p type %d] ID map has NULL parent reference\n", + node, node->type); + goto fail_map; + } + node =3D ACPI_ADD_PTR(struct acpi_iort_node, iort_table, map->output_reference); } --=20 2.19.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#54767): https://edk2.groups.io/g/devel/message/54767 Mute This Topic: https://groups.io/mt/71530000/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-