From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from huawei.com (huawei.com [45.249.212.190]) by mx.groups.io with SMTP id smtpd.web10.1272.1582621989580072179 for ; Tue, 25 Feb 2020 01:13:10 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.190, mailfrom: guoheyi@huawei.com) Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 28C86F906FC2DC051B6F for ; Tue, 25 Feb 2020 17:13:07 +0800 (CST) Received: from [127.0.0.1] (10.173.221.228) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Tue, 25 Feb 2020 17:13:02 +0800 Subject: Re: [edk2-devel] [PATCH] acpi/iort: check output reference for the real used mapping To: References: <15F699D2B1B4D3AE.21025@groups.io> From: "Guoheyi" Message-ID: Date: Tue, 25 Feb 2020 17:13:02 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <15F699D2B1B4D3AE.21025@groups.io> X-Originating-IP: [10.173.221.228] X-CFilter-Loop: Reflected Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Hi all, Please ignore it. I made a mistake of sending to the wrong mailing list... Sorry for the noise. And have a good day :) Heyi On 2020/2/25 17:01, Guoheyi wrote: > 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 = ACPI_ADD_PTR(struct acpi_iort_id_mapping, node, > node->mapping_offset); > > - /* 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 == node->mapping_count) > goto fail_map; > > + /* 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 = ACPI_ADD_PTR(struct acpi_iort_node, iort_table, > map->output_reference); > }