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 698551DF970 for ; Thu, 16 Oct 2025 23:00:12 +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=1760655612; cv=none; b=Ylyz+TxbOS8R3IkKgKV1+EJaoZv4VlfuQe9X0+dvF0vQtXA87BzbyR4CkD+R/96JAJJqbN0JikYZ2F2Pu5YXq1SVwVhAMaoHCveB40bfotzefOGs3Oh0zX0tP5UlorenFsqrW/hqveQGHuXPxdVUjJ6grzpwWqnjXFegPdYoW/8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760655612; c=relaxed/simple; bh=rATaF/zF6/CpEF/gVPKdGEwwNlOO4rsDqRQs4KX/Qgs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E9D9CMG50VTG4h3qSGDXn+/bFz7RD2Fl6j0h/yJA8MA4e/cnUDUOiq6O97kCqdxD8Jexx8gctppS9CIU3738jfIiqsr3aBYciNWQDSu5VsJrEqj+0vnJWZyxosK1c51NSIucHqAgNss+D7UMNTh/XUR2pef26rzF3Xp2xXSBQ+0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jXvV9P4t; 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="jXvV9P4t" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 694B9C4CEFE; Thu, 16 Oct 2025 23:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760655611; bh=rATaF/zF6/CpEF/gVPKdGEwwNlOO4rsDqRQs4KX/Qgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jXvV9P4tq56P5TKNe6vQD7I9I5gvQElMXN61BP8uxff+64LfMPpzvFWz2rpath+oQ GcU2d18RHQYYhldEqWaBFz+jKkyhCK1DeD4ScRo21RH5Ihh9KIjEkQm7PS6OSg8usY HXgazRl0eVJIneUFgL/9yZhwgsbYueauKTv+ayFHjMwtj5CDS+QiCKetN5Me+Xh0uA lZ/6XkvI/uD2wGuV3/rgjIEoSIPp8kC0ZJX6l9KzxKSj+uazLhjWtxsTUx0VOBRwF3 rkGWM2TdUMN4vm4wxANcyjENQmhXnkHARlST1+LIXXJulOBcMBQJSOQGRgk07LytTq bAuIhXXptqkfw== From: Sasha Levin To: stable@vger.kernel.org Cc: "Rafael J. Wysocki" , Sakari Ailus , Sasha Levin Subject: [PATCH 6.1.y 4/4] ACPI: property: Do not pass NULL handles to acpi_attach_data() Date: Thu, 16 Oct 2025 19:00:07 -0400 Message-ID: <20251016230007.3453571-4-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251016230007.3453571-1-sashal@kernel.org> References: <2025101649-bride-landmark-1121@gregkh> <20251016230007.3453571-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 baf60d5cb8bc6b85511c5df5f0ad7620bb66d23c ] In certain circumstances, the ACPI handle of a data-only node may be NULL, in which case it does not make sense to attempt to attach that node to an ACPI namespace object, so update the code to avoid attempts to do so. This prevents confusing and unuseful error messages from being printed. Also document the fact that the ACPI handle of a data-only node may be NULL and when that happens in a code comment. In addition, make acpi_add_nondev_subnodes() print a diagnostic message for each data-only node with an unknown ACPI namespace scope. Fixes: 1d52f10917a7 ("ACPI: property: Tie data nodes to acpi handles") Cc: 6.0+ # 6.0+ Signed-off-by: Rafael J. Wysocki Reviewed-by: Sakari Ailus Tested-by: Sakari Ailus Signed-off-by: Sasha Levin --- drivers/acpi/property.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index af18c939acc3a..46003b642b597 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -112,6 +112,10 @@ static bool acpi_nondev_subnode_extract(union acpi_object *desc, result = true; if (result) { + /* + * This will be NULL if the desc package is embedded in an outer + * _DSD-equivalent package and its scope cannot be determined. + */ dn->handle = handle; dn->data.pointer = desc; list_add_tail(&dn->sibling, list); @@ -212,6 +216,8 @@ static bool acpi_add_nondev_subnodes(acpi_handle scope, * strings because there is no way to build full * pathnames out of them. */ + acpi_handle_debug(scope, "subnode %s: Unknown scope\n", + link->package.elements[0].string.pointer); desc = &link->package.elements[1]; result = acpi_nondev_subnode_extract(desc, NULL, link, list, parent); @@ -384,6 +390,9 @@ static void acpi_untie_nondev_subnodes(struct acpi_device_data *data) struct acpi_data_node *dn; list_for_each_entry(dn, &data->subnodes, sibling) { + if (!dn->handle) + continue; + acpi_detach_data(dn->handle, acpi_nondev_subnode_tag); acpi_untie_nondev_subnodes(&dn->data); @@ -398,6 +407,9 @@ static bool acpi_tie_nondev_subnodes(struct acpi_device_data *data) acpi_status status; bool ret; + if (!dn->handle) + continue; + status = acpi_attach_data(dn->handle, acpi_nondev_subnode_tag, dn); if (ACPI_FAILURE(status) && status != AE_ALREADY_EXISTS) { acpi_handle_err(dn->handle, "Can't tag data node\n"); -- 2.51.0