Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1135848ybf; Thu, 27 Feb 2020 05:42:48 -0800 (PST) X-Google-Smtp-Source: APXvYqz0VabisEhoIeynbztL7QxWTkjPs3ZzBiRcPF9A4Cx1Eq0Qbxq7hqFUk+UVUfrDjA8Wo76E X-Received: by 2002:a05:6830:1385:: with SMTP id d5mr3488494otq.61.1582810968632; Thu, 27 Feb 2020 05:42:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582810968; cv=none; d=google.com; s=arc-20160816; b=Mzvm+3hpKqULBZa+AX2b4sT+xk1LL0WpcWyKgyEic5PF9CAi+gVqzT43EEWh/F6h2k 3mzBfpQWhWGAN7+j2EfR1/7DCkDS6jLEgsbG2X7kZoB/1Ffa4KRfVLGBzhLBWFvSpGzf qG+8c9CNUATvcaOn0eoCjXXKW5BugP4T6W9VVEf60MRY7ytJizCDvAADVoR7GWyrvQ1J dHZptpErWtvHLaHDqiqiLyGRDno7tSRHLrb88jveROiFw0hfqZFi2pif6rvB/hxx4F14 698i9da5ZvTrn7IGG+h+FhJVKI/3W29vx9DHlVavNRFJzMdx0lhPDFLu7JYvY5Jxyp4D 39nA== 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=tKC3GcfBLS8SPm7fhCxEfAYYSFYw0VD5eX+MHoBAEas=; b=rlm68ygWn3JpzuwYHb83gOV17mx/iTlh6TS3+tOsYBC2eI9VfK8R+IBXh5QwDtqFp8 lEstwRx0B7Nkfl3D65TTuK763AKi6rjyUdbmJeHTzcqSKRpFVCpzpG88MUQEQli5oDdh h8CAGKPcD3ItedfhlMDxM63Krp8Dc0/GTVkmUM0TrIvQC/MY7rrohQQmRbB0ORWpJGZs 3pvlbkqf9f4yf5xIpZ1MoTdUb4zw73DGgYEL+npjGuSvoD3ftB3LFg0GTp0xsdPgtHlH hRPyr/XZlcTOYupeFby4pXCvk3EhdrX4Gl4w2vcu78Hm7qM+sXL146vram6tansrJ1CI i40g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I1BUNzwf; 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 k125si1420033oib.212.2020.02.27.05.42.36; Thu, 27 Feb 2020 05:42:48 -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=I1BUNzwf; 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 S1729696AbgB0Nl4 (ORCPT + 99 others); Thu, 27 Feb 2020 08:41:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:36660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729305AbgB0Nlz (ORCPT ); Thu, 27 Feb 2020 08:41:55 -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 4171E20578; Thu, 27 Feb 2020 13:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582810914; bh=yXPAC0nsG2Ll0nlhuKek2bvAD39awm9bKNUoZsYnVOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I1BUNzwf6evIfKDvN3NGIIIUBVh6hSF2xQbbc5lsm58vTNcSw0VigT8oNwYMnDUfa VEAWJO+40k59AqTih1WRQG60nyt2Lqmo/3DOoicPNMS19wkKfArFg8eaXJv76IHNsd coArekyhsm4KX4ANtEZkOCe93GfEyd/Ze/ciIx08= 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.4 045/113] ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1 Date: Thu, 27 Feb 2020 14:36:01 +0100 Message-Id: <20200227132218.947307523@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132211.791484803@linuxfoundation.org> References: <20200227132211.791484803@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 20de148594fdc..d56cbcda37c13 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c @@ -272,7 +272,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 097188a6b1c1b..35f1d7657927a 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c @@ -440,6 +440,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