Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1616883ybv; Fri, 21 Feb 2020 00:21:50 -0800 (PST) X-Google-Smtp-Source: APXvYqzAlEDshfR60CLIcFtbTUTPms1HcpC9ZQf6kV6XSJbSKTr+yQTIT3jzcZqSKxUGYK5dPqiz X-Received: by 2002:a9d:6418:: with SMTP id h24mr27067247otl.172.1582273310725; Fri, 21 Feb 2020 00:21:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273310; cv=none; d=google.com; s=arc-20160816; b=RxO88+U+xdaUNQa29Wk807rYCnZDwfjXFRjSOrFWUGzetDGBAvAuE1GDtUqOuM7ZTj ci6/aP5RJyBsezlcF83tr9qFws9oKCRMtAgBLMkhb57iOrT7xj850XZubbgYIndOq+IH PokeCwyZBTk8T3SLC7+BKPWjDTdEIcawvqhu0lEq9DEQdR3kzk8CDTrcsAW92vsxGlmk UpGbF8UdMmj+QCAhOvmI7UOecL1+K5ZiVqAVAy1ooTLZOEiCE1vPfluCgLUOkH36KSl9 +cMGuFTMymNF6zogp3yl9IpP3f3ngy7qGXsA3EHvTiBOYd7BU9Qq8SjFhY6EkdvRiFii lI8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g4PJWJh8UvpxndxdlqSYwkynlc1qg4SxViHVtTOOfwE=; b=htO/0yry/CsgDDN5Gsf0EbhtE8AKNATv6PMmV2PateEk9IGEkzCMBxoA2tb3o6RLKu 8IZM1SGHWssUCu5KyL3W7FBhEZp8XM5IXn9JUSV9P6xNGTA4tiuyJdTzK4NO0bbctkRO CaJW+tpqIBKRhMV98gTHonvprjphk3fvUV9UvFRTt8WxD+VNGJxhsm1XO0shhA4kF2H4 Z6jxiFn/XuXuKrrw0sohbJnjL5y7aByqCMLikHGz13ggYpmTObsYUgyGf8hwuahs7OeY JsAPiNRuaJ/wtPcYuY/lqDszq9j+zEKjxj/4jhbyadB0JL9lJ9zSMv4iIPK1OjndtvjO VXiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pD8re6bJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p186si416576oih.172.2020.02.21.00.21.38; Fri, 21 Feb 2020 00:21:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pD8re6bJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388105AbgBUIUC (ORCPT + 99 others); Fri, 21 Feb 2020 03:20:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:58756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729254AbgBUIT6 (ORCPT ); Fri, 21 Feb 2020 03:19:58 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DAA0424691; Fri, 21 Feb 2020 08:19:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582273197; bh=t3/xW81Zt7Ux01R6RuadXWhbtEXwtJtoxuf6rN4pBHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pD8re6bJufaObFInbiOX8EFhzP7+6tUv7Jz8McB+Ichv+iRyP0aVdp0S1g6wMLIwb PGP/QGckmzeF9qXvbhwFSCShU2N7gyBCJBH/mT09jN2pq9p33HXhNGWALE7w3XPutG 40BIDhLRLppbmEFyCSY9UIxn/i3P6ZT0NqIjW95k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Elia Geretto , Bob Moore , Erik Kaneda , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.19 080/191] ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1 Date: Fri, 21 Feb 2020 08:40:53 +0100 Message-Id: <20200221072300.820702915@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Erik Kaneda [ Upstream commit 5ddbd77181dfca61b16d2e2222382ea65637f1b9 ] ACPICA commit 29cc8dbc5463a93625bed87d7550a8bed8913bf4 create_buffer_field is a deferred op that is typically processed in load pass 2. However, disassembly of control method contents walk the parse tree with ACPI_PARSE_LOAD_PASS1 and AML_CREATE operators are processed in a later walk. This is a problem when there is a control method that has the same name as the AML_CREATE object. In this case, any use of the name segment will be detected as a method call rather than a reference to a buffer field. If this is detected as a method call, it can result in a mal-formed parse tree if the control methods have parameters. This change in processing AML_CREATE ops earlier solves this issue by inserting the named object in the ACPI namespace so that references to this name would be detected as a name string rather than a method call. Link: https://github.com/acpica/acpica/commit/29cc8dbc Reported-by: Elia Geretto Tested-by: Elia Geretto Signed-off-by: Bob Moore Signed-off-by: Erik Kaneda Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpica/dsfield.c | 2 +- drivers/acpi/acpica/dswload.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index 30fe89545d6ab..bcc6a7acc5762 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c @@ -244,7 +244,7 @@ cleanup: * FUNCTION: acpi_ds_get_field_names * * PARAMETERS: info - create_field info structure - * ` walk_state - Current method state + * walk_state - Current method state * arg - First parser arg for the field name list * * RETURN: Status diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index d06c414462822..ba53662f12179 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c @@ -412,6 +412,27 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state)); + /* + * Disassembler: handle create field operators here. + * + * create_buffer_field is a deferred op that is typically processed in load + * pass 2. However, disassembly of control method contents walk the parse + * tree with ACPI_PARSE_LOAD_PASS1 and AML_CREATE operators are processed + * in a later walk. This is a problem when there is a control method that + * has the same name as the AML_CREATE object. In this case, any use of the + * name segment will be detected as a method call rather than a reference + * to a buffer field. + * + * This earlier creation during disassembly solves this issue by inserting + * the named object in the ACPI namespace so that references to this name + * would be a name string rather than a method call. + */ + if ((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) && + (walk_state->op_info->flags & AML_CREATE)) { + status = acpi_ds_create_buffer_field(op, walk_state); + return_ACPI_STATUS(status); + } + /* We are only interested in opcodes that have an associated name */ if (!(walk_state->op_info->flags & (AML_NAMED | AML_FIELD))) { -- 2.20.1