Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1638047ybv; Fri, 21 Feb 2020 00:46:50 -0800 (PST) X-Google-Smtp-Source: APXvYqxRVteTF+4yZ6cZsL3vy4WaLABPy26+QowMYy6OH4pUkj/64VtwRIW16+jKSK5qHQDH1I46 X-Received: by 2002:a9d:10d:: with SMTP id 13mr15168247otu.238.1582274810047; Fri, 21 Feb 2020 00:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582274810; cv=none; d=google.com; s=arc-20160816; b=pyUmSdrMhFTxmgPBYWZk81Xks30PojgKXKfpf2D6JMNH8+N+KMc6+tLBNK+tQD5Q3d iAXI20FOrdQ4Ss+xjvD31rvFMdtNzpbrHtP7V/R/hOwL4Hhc7nT7hoAr3mpR+6wb6sdI B8qBu4fEODZRAHMUITBoLKc4RLyC6Tk3AEqu09VynVbV4Y51clh9pzwQmgd8WsmdhKv3 cJ3037tEaRPcHOGPZg3fLAIkQ0sMrSYrr2dm/yxc64Js+xlBPEj8WOZcgBkizQIanD4h Tqtlo7En1NKPu32a9wZhUQzNfYRUCaVDiTiOglHoElzfUJ3CFPJSxvQQK+nctBhuT83M cY1g== 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=qg8kRDva/V/4VLXNP9DS6CuupLktuD9EBmjEAOxuI6A=; b=mGFc6D5XV4WNrTQK9l/jAEf4r/Fa1AA/44mtYsMBNnTRWlb/5ttpFSq4Kw9O7IiQaa sfK2vwOFWZ+B/XtvundXyOTZMWrOAEOTV2OEojdLFcYsAEZVtFGpREidWTg94Hbn+nUU feT0+X5fyGcGoOvzSyyShDiAy01Z0xgpTFXKyd85HSL1dQ72VhCjDPiU2YgP3ZYmc2oU 9tzeivMZ5DrAg/Td4JMY3P1XnATL6vgzkg4TsqcVrUMSxFYxuTtec6ZCLWSv5ZQFTxmh Erf8Ls1R/143L/qMPB2pHXh+9EhPOqntuKCHRd7vXBHTqigctw/E4xWr1mJN3i1GoiwV 3ceQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A+XaFLRk; 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 l9si1054424oti.229.2020.02.21.00.46.38; Fri, 21 Feb 2020 00:46: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=A+XaFLRk; 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 S1732264AbgBUIqG (ORCPT + 99 others); Fri, 21 Feb 2020 03:46:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:47416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727312AbgBUHub (ORCPT ); Fri, 21 Feb 2020 02:50:31 -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 86F78208C4; Fri, 21 Feb 2020 07:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582271431; bh=wDgTXAYqrHF69lKyEGtAFpaIPFToVjWsBRScPMs0/Kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A+XaFLRkLOgKHaqI3okcsajCnuIjGNlihJ98ZUjCYA0PxRgbfowVDGqHrfj+9K/Wc 6OOnDdRkZvH6+P2Sf99tPBpJDOS12zgbyK7drN0MD23CIDzXLMEJB+3QBxwkixNYoe 0m5qnKEboi91s0fFtMnRFlqHQ9mPJRai21crhwQA= 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 5.5 164/399] ACPICA: Disassembler: create buffer fields in ACPI_PARSE_LOAD_PASS1 Date: Fri, 21 Feb 2020 08:38:09 +0100 Message-Id: <20200221072418.537695074@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072402.315346745@linuxfoundation.org> References: <20200221072402.315346745@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 faa38a22263ad..ae713d746c8b8 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c @@ -243,7 +243,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 c88fd31208a5b..4bcf15bf03ded 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c @@ -410,6 +410,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