Skip to content

Commit d0759b1

Browse files
committed
ACPI: property: Fix buffer properties extraction for subnodes
The ACPI handle passed to acpi_extract_properties() as the first argument represents the ACPI namespace scope in which to look for objects returning buffers associated with buffer properties. For _DSD objects located immediately under ACPI devices, this handle is the same as the handle of the device object holding the _DSD, but for data-only subnodes it is not so. First of all, data-only subnodes are represented by objects that cannot hold other objects in their scopes (like control methods). Therefore a data-only subnode handle cannot be used for completing relative pathname segments, so the current code in in acpi_nondev_subnode_extract() passing a data-only subnode handle to acpi_extract_properties() is invalid. Moreover, a data-only subnode of device A may be represented by an object located in the scope of device B (which kind of makes sense, for instance, if A is a B's child). In that case, the scope in question would be the one of device B. In other words, the scope mentioned above is the same as the scope used for subnode object lookup in acpi_nondev_subnode_extract(). Accordingly, rearrange that function to use the same scope for the extraction of properties and subnode object lookup. Fixes: 103e10c ("ACPI: property: Add support for parsing buffer property UUID") Cc: 6.0+ <stable@vger.kernel.org> # 6.0+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
1 parent f83ec76 commit d0759b1

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

drivers/acpi/property.c

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ static bool acpi_nondev_subnode_extract(union acpi_object *desc,
8383
struct fwnode_handle *parent)
8484
{
8585
struct acpi_data_node *dn;
86+
acpi_handle scope = NULL;
8687
bool result;
8788

8889
if (acpi_graph_ignore_port(handle))
@@ -98,27 +99,18 @@ static bool acpi_nondev_subnode_extract(union acpi_object *desc,
9899
INIT_LIST_HEAD(&dn->data.properties);
99100
INIT_LIST_HEAD(&dn->data.subnodes);
100101

101-
result = acpi_extract_properties(handle, desc, &dn->data);
102-
103-
if (handle) {
104-
acpi_handle scope;
105-
acpi_status status;
102+
/*
103+
* The scope for the completion of relative pathname segments and
104+
* subnode object lookup is the one of the namespace node (device)
105+
* containing the object that has returned the package. That is, it's
106+
* the scope of that object's parent device.
107+
*/
108+
if (handle)
109+
acpi_get_parent(handle, &scope);
106110

107-
/*
108-
* The scope for the subnode object lookup is the one of the
109-
* namespace node (device) containing the object that has
110-
* returned the package. That is, it's the scope of that
111-
* object's parent.
112-
*/
113-
status = acpi_get_parent(handle, &scope);
114-
if (ACPI_SUCCESS(status)
115-
&& acpi_enumerate_nondev_subnodes(scope, desc, &dn->data,
116-
&dn->fwnode))
117-
result = true;
118-
} else if (acpi_enumerate_nondev_subnodes(NULL, desc, &dn->data,
119-
&dn->fwnode)) {
111+
result = acpi_extract_properties(scope, desc, &dn->data);
112+
if (acpi_enumerate_nondev_subnodes(scope, desc, &dn->data, &dn->fwnode))
120113
result = true;
121-
}
122114

123115
if (result) {
124116
dn->handle = handle;

0 commit comments

Comments
 (0)