From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2475C22424E for ; Thu, 16 Oct 2025 19:28:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760642916; cv=none; b=AYPkWtA5ZVm0bjTWu4gCn70+UDruDaPPTWsBKdYwCZ5YSRASduVZjIscfzkw6wAXWYD2qiQSPwsKC6r3ocv/dzKSygt1fsV29h9cNMgbUhXBbYVyGhvQKqIgPw8+QMxHoh/hDK0IY8A3QRf9mBPXx+HsiUbz5pd/XfGNW2CV4QQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760642916; c=relaxed/simple; bh=sxS/7LkQuZnRf/ZMRhAdNexxTaXDrCHm6XAmd6YEuB8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cykCGUDgQiPdtpgCM4KmAx/7htiqG8pNJ1qjNN4PxzIclThjq88RBhdylWf1RJ2tIreVU/ejH/1wBGUwb0wNrH7q+ffmKw1qo7lIDmH6R+PCTk4YHOjyfXQvOgB1FAvoTqZ8C+rMHIrGhKA7ZUZRGO9G1Vv57kFN2OPcIG2tVFQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=THNOPV8i; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="THNOPV8i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CB83C4CEF9; Thu, 16 Oct 2025 19:28:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760642915; bh=sxS/7LkQuZnRf/ZMRhAdNexxTaXDrCHm6XAmd6YEuB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=THNOPV8iRu+IBc4yj4AqUeygWKrq+QWfm4QgAIQXP2jbO2VGhdy5a7axJQGyJV9xW 279bnComDpfQzCtXvzQdP8dDantpjaH9NRHFk1gwPd+wLj1oS9wNzKUni3mYidIrHD b4bq7Mvm7c4mq+vOyKp/urE4qyBm6xBvNLJPxb4OV1RPGDJULKYH8hrenH3CwPydE9 LjFD7A289iH9efqLHy62x4wbmw5LyBsic6eu4W84bF4PjzxFQ2kAK47ERACKNccACx 1GgsAxqmYWO6mgtlTlKyAY8fK0VdJBoX8pZ8/MAn4N8ROhGCxe2hSKLSEXcqRopG2S 2W3FQZBcUbzqg== From: Sasha Levin To: stable@vger.kernel.org Cc: "Rafael J. Wysocki" , Sakari Ailus , Sasha Levin Subject: [PATCH 6.6.y 2/4] ACPI: property: Disregard references in data-only subnode lists Date: Thu, 16 Oct 2025 15:28:30 -0400 Message-ID: <20251016192832.3384290-2-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251016192832.3384290-1-sashal@kernel.org> References: <2025101648-surely-manhunt-fac9@gregkh> <20251016192832.3384290-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Rafael J. Wysocki" [ Upstream commit d06118fe9b03426484980ed4c189a8c7b99fa631 ] Data-only subnode links following the ACPI data subnode GUID in a _DSD package are expected to point to named objects returning _DSD-equivalent packages. If a reference to such an object is used in the target field of any of those links, that object will be evaluated in place (as a named object) and its return data will be embedded in the outer _DSD package. For this reason, it is not expected to see a subnode link with the target field containing a local reference (that would mean pointing to a device or another object that cannot be evaluated in place and therefore cannot return a _DSD-equivalent package). Accordingly, simplify the code parsing data-only subnode links to simply print a message when it encounters a local reference in the target field of one of those links. Moreover, since acpi_nondev_subnode_data_ok() would only have one caller after the change above, fold it into that caller. Link: https://lore.kernel.org/linux-acpi/CAJZ5v0jVeSrDO6hrZhKgRZrH=FpGD4vNUjFD8hV9WwN9TLHjzQ@mail.gmail.com/ Signed-off-by: Rafael J. Wysocki Reviewed-by: Sakari Ailus Tested-by: Sakari Ailus Stable-dep-of: baf60d5cb8bc ("ACPI: property: Do not pass NULL handles to acpi_attach_data()") Signed-off-by: Sasha Levin --- drivers/acpi/property.c | 51 ++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 3058ed410810b..e61726b4a48c5 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -112,32 +112,12 @@ static bool acpi_nondev_subnode_extract(union acpi_object *desc, return false; } -static bool acpi_nondev_subnode_data_ok(acpi_handle handle, - const union acpi_object *link, - struct list_head *list, - struct fwnode_handle *parent) -{ - struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER }; - acpi_status status; - - status = acpi_evaluate_object_typed(handle, NULL, NULL, &buf, - ACPI_TYPE_PACKAGE); - if (ACPI_FAILURE(status)) - return false; - - if (acpi_nondev_subnode_extract(buf.pointer, handle, link, list, - parent)) - return true; - - ACPI_FREE(buf.pointer); - return false; -} - static bool acpi_nondev_subnode_ok(acpi_handle scope, const union acpi_object *link, struct list_head *list, struct fwnode_handle *parent) { + struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER }; acpi_handle handle; acpi_status status; @@ -149,7 +129,17 @@ static bool acpi_nondev_subnode_ok(acpi_handle scope, if (ACPI_FAILURE(status)) return false; - return acpi_nondev_subnode_data_ok(handle, link, list, parent); + status = acpi_evaluate_object_typed(handle, NULL, NULL, &buf, + ACPI_TYPE_PACKAGE); + if (ACPI_FAILURE(status)) + return false; + + if (acpi_nondev_subnode_extract(buf.pointer, handle, link, list, + parent)) + return true; + + ACPI_FREE(buf.pointer); + return false; } static bool acpi_add_nondev_subnodes(acpi_handle scope, @@ -162,7 +152,6 @@ static bool acpi_add_nondev_subnodes(acpi_handle scope, for (i = 0; i < links->package.count; i++) { union acpi_object *link, *desc; - acpi_handle handle; bool result; link = &links->package.elements[i]; @@ -174,22 +163,26 @@ static bool acpi_add_nondev_subnodes(acpi_handle scope, if (link->package.elements[0].type != ACPI_TYPE_STRING) continue; - /* The second one may be a string, a reference or a package. */ + /* The second one may be a string or a package. */ switch (link->package.elements[1].type) { case ACPI_TYPE_STRING: result = acpi_nondev_subnode_ok(scope, link, list, parent); break; - case ACPI_TYPE_LOCAL_REFERENCE: - handle = link->package.elements[1].reference.handle; - result = acpi_nondev_subnode_data_ok(handle, link, list, - parent); - break; case ACPI_TYPE_PACKAGE: desc = &link->package.elements[1]; result = acpi_nondev_subnode_extract(desc, NULL, link, list, parent); break; + case ACPI_TYPE_LOCAL_REFERENCE: + /* + * It is not expected to see any local references in + * the links package because referencing a named object + * should cause it to be evaluated in place. + */ + acpi_handle_info(scope, "subnode %s: Unexpected reference\n", + link->package.elements[0].string.pointer); + fallthrough; default: result = false; break; -- 2.51.0