public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
@ 2019-04-30 15:52 Pierre-Louis Bossart
  2019-04-30 15:52 ` Pierre-Louis Bossart
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Pierre-Louis Bossart @ 2019-04-30 15:52 UTC (permalink / raw)
  To: linux-acpi
  Cc: Rafael J . Wysocki, Len Brown, linux-kernel, Mika Westerberg,
	Andy Shevchenko, Pierre-Louis Bossart

When the DSDT tables expose devices with subdevices and a set of
hierarchical _DSD properties, the data returned by
acpi_get_next_subnode() is incorrect, with the results suggesting a bad
pointer assignment. The parser works fine with device_nodes or
data_nodes, but not with a combination of the two.

The problem is traced to an invalid pointer used when jumping from
handling device_nodes to data nodes. The existing code looks for data
nodes below the last subdevice found instead of the common root. Fix
by forcing the acpi_device pointer to be derived from the same fwnode
for the two types of subnodes.

This same problem of handling device and data nodes was already fixed
in a similar way by 'commit bf4703fdd166 ("ACPI / property: fix data
node parsing in acpi_get_next_subnode()")' but broken later by 'commit
34055190b19 ("ACPI / property: Add fwnode_get_next_child_node()")', so
this should probably go to linux-stable all the way to 4.12

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/acpi/property.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 5815356ea6ad..efc74f912f39 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -943,6 +943,16 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
 		const struct acpi_data_node *data = to_acpi_data_node(fwnode);
 		struct acpi_data_node *dn;
 
+		/*
+		 * We can have a combination of device and data nodes,
+		 * e.g. with hierarchical _DSD properties. Make sure
+		 * the adev pointer is restored before going through
+		 * data nodes, otherwise we will be looking for
+		 * data_nodes below the last device found instead of
+		 * the common fwnode shared by device_nodes and
+		 * data_nodes
+		 */
+		adev = to_acpi_device_node(fwnode);
 		if (adev)
 			head = &adev->data.subnodes;
 		else if (data)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
  2019-04-30 15:52 [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode() Pierre-Louis Bossart
@ 2019-04-30 15:52 ` Pierre-Louis Bossart
  2019-04-30 16:30 ` Andy Shevchenko
  2019-05-01  8:11 ` Rafael J. Wysocki
  2 siblings, 0 replies; 10+ messages in thread
From: Pierre-Louis Bossart @ 2019-04-30 15:52 UTC (permalink / raw)
  To: linux-acpi
  Cc: Rafael J . Wysocki, Len Brown, linux-kernel, Mika Westerberg,
	Andy Shevchenko, Pierre-Louis Bossart

When the DSDT tables expose devices with subdevices and a set of
hierarchical _DSD properties, the data returned by
acpi_get_next_subnode() is incorrect, with the results suggesting a bad
pointer assignment. The parser works fine with device_nodes or
data_nodes, but not with a combination of the two.

The problem is traced to an invalid pointer used when jumping from
handling device_nodes to data nodes. The existing code looks for data
nodes below the last subdevice found instead of the common root. Fix
by forcing the acpi_device pointer to be derived from the same fwnode
for the two types of subnodes.

This same problem of handling device and data nodes was already fixed
in a similar way by 'commit bf4703fdd166 ("ACPI / property: fix data
node parsing in acpi_get_next_subnode()")' but broken later by 'commit
34055190b19 ("ACPI / property: Add fwnode_get_next_child_node()")', so
this should probably go to linux-stable all the way to 4.12

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/acpi/property.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 5815356ea6ad..efc74f912f39 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -943,6 +943,16 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
 		const struct acpi_data_node *data = to_acpi_data_node(fwnode);
 		struct acpi_data_node *dn;
 
+		/*
+		 * We can have a combination of device and data nodes,
+		 * e.g. with hierarchical _DSD properties. Make sure
+		 * the adev pointer is restored before going through
+		 * data nodes, otherwise we will be looking for
+		 * data_nodes below the last device found instead of
+		 * the common fwnode shared by device_nodes and
+		 * data_nodes
+		 */
+		adev = to_acpi_device_node(fwnode);
 		if (adev)
 			head = &adev->data.subnodes;
 		else if (data)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
  2019-04-30 15:52 [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode() Pierre-Louis Bossart
  2019-04-30 15:52 ` Pierre-Louis Bossart
@ 2019-04-30 16:30 ` Andy Shevchenko
  2019-04-30 16:30   ` Andy Shevchenko
  2019-04-30 16:41   ` Pierre-Louis Bossart
  2019-05-01  8:11 ` Rafael J. Wysocki
  2 siblings, 2 replies; 10+ messages in thread
From: Andy Shevchenko @ 2019-04-30 16:30 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: linux-acpi, Rafael J . Wysocki, Len Brown, linux-kernel,
	Mika Westerberg

On Tue, Apr 30, 2019 at 10:52:29AM -0500, Pierre-Louis Bossart wrote:
> When the DSDT tables expose devices with subdevices and a set of
> hierarchical _DSD properties, the data returned by
> acpi_get_next_subnode() is incorrect, with the results suggesting a bad
> pointer assignment. The parser works fine with device_nodes or
> data_nodes, but not with a combination of the two.
> 
> The problem is traced to an invalid pointer used when jumping from
> handling device_nodes to data nodes. The existing code looks for data
> nodes below the last subdevice found instead of the common root. Fix
> by forcing the acpi_device pointer to be derived from the same fwnode
> for the two types of subnodes.
> 
> This same problem of handling device and data nodes was already fixed
> in a similar way by 'commit bf4703fdd166 ("ACPI / property: fix data
> node parsing in acpi_get_next_subnode()")' but broken later by 'commit
> 34055190b19 ("ACPI / property: Add fwnode_get_next_child_node()")', so
> this should probably go to linux-stable all the way to 4.12

Period is missed in above sentence.

I think it make sense to add Fixes: tag.

Nevertheless,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thank you for fixing this interesting issue!

> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  drivers/acpi/property.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
> index 5815356ea6ad..efc74f912f39 100644
> --- a/drivers/acpi/property.c
> +++ b/drivers/acpi/property.c
> @@ -943,6 +943,16 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
>  		const struct acpi_data_node *data = to_acpi_data_node(fwnode);
>  		struct acpi_data_node *dn;
>  
> +		/*
> +		 * We can have a combination of device and data nodes,
> +		 * e.g. with hierarchical _DSD properties. Make sure
> +		 * the adev pointer is restored before going through
> +		 * data nodes, otherwise we will be looking for
> +		 * data_nodes below the last device found instead of
> +		 * the common fwnode shared by device_nodes and
> +		 * data_nodes
> +		 */
> +		adev = to_acpi_device_node(fwnode);
>  		if (adev)
>  			head = &adev->data.subnodes;
>  		else if (data)
> -- 
> 2.17.1
> 

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
  2019-04-30 16:30 ` Andy Shevchenko
@ 2019-04-30 16:30   ` Andy Shevchenko
  2019-04-30 16:41   ` Pierre-Louis Bossart
  1 sibling, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2019-04-30 16:30 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: linux-acpi, Rafael J . Wysocki, Len Brown, linux-kernel,
	Mika Westerberg

On Tue, Apr 30, 2019 at 10:52:29AM -0500, Pierre-Louis Bossart wrote:
> When the DSDT tables expose devices with subdevices and a set of
> hierarchical _DSD properties, the data returned by
> acpi_get_next_subnode() is incorrect, with the results suggesting a bad
> pointer assignment. The parser works fine with device_nodes or
> data_nodes, but not with a combination of the two.
> 
> The problem is traced to an invalid pointer used when jumping from
> handling device_nodes to data nodes. The existing code looks for data
> nodes below the last subdevice found instead of the common root. Fix
> by forcing the acpi_device pointer to be derived from the same fwnode
> for the two types of subnodes.
> 
> This same problem of handling device and data nodes was already fixed
> in a similar way by 'commit bf4703fdd166 ("ACPI / property: fix data
> node parsing in acpi_get_next_subnode()")' but broken later by 'commit
> 34055190b19 ("ACPI / property: Add fwnode_get_next_child_node()")', so
> this should probably go to linux-stable all the way to 4.12

Period is missed in above sentence.

I think it make sense to add Fixes: tag.

Nevertheless,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thank you for fixing this interesting issue!

> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  drivers/acpi/property.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
> index 5815356ea6ad..efc74f912f39 100644
> --- a/drivers/acpi/property.c
> +++ b/drivers/acpi/property.c
> @@ -943,6 +943,16 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
>  		const struct acpi_data_node *data = to_acpi_data_node(fwnode);
>  		struct acpi_data_node *dn;
>  
> +		/*
> +		 * We can have a combination of device and data nodes,
> +		 * e.g. with hierarchical _DSD properties. Make sure
> +		 * the adev pointer is restored before going through
> +		 * data nodes, otherwise we will be looking for
> +		 * data_nodes below the last device found instead of
> +		 * the common fwnode shared by device_nodes and
> +		 * data_nodes
> +		 */
> +		adev = to_acpi_device_node(fwnode);
>  		if (adev)
>  			head = &adev->data.subnodes;
>  		else if (data)
> -- 
> 2.17.1
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
  2019-04-30 16:30 ` Andy Shevchenko
  2019-04-30 16:30   ` Andy Shevchenko
@ 2019-04-30 16:41   ` Pierre-Louis Bossart
  2019-04-30 16:41     ` Pierre-Louis Bossart
  2019-04-30 16:47     ` Andy Shevchenko
  1 sibling, 2 replies; 10+ messages in thread
From: Pierre-Louis Bossart @ 2019-04-30 16:41 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-acpi, Rafael J . Wysocki, Len Brown, linux-kernel,
	Mika Westerberg

On 4/30/19 11:30 AM, Andy Shevchenko wrote:
> On Tue, Apr 30, 2019 at 10:52:29AM -0500, Pierre-Louis Bossart wrote:
>> When the DSDT tables expose devices with subdevices and a set of
>> hierarchical _DSD properties, the data returned by
>> acpi_get_next_subnode() is incorrect, with the results suggesting a bad
>> pointer assignment. The parser works fine with device_nodes or
>> data_nodes, but not with a combination of the two.
>>
>> The problem is traced to an invalid pointer used when jumping from
>> handling device_nodes to data nodes. The existing code looks for data
>> nodes below the last subdevice found instead of the common root. Fix
>> by forcing the acpi_device pointer to be derived from the same fwnode
>> for the two types of subnodes.
>>
>> This same problem of handling device and data nodes was already fixed
>> in a similar way by 'commit bf4703fdd166 ("ACPI / property: fix data
>> node parsing in acpi_get_next_subnode()")' but broken later by 'commit
>> 34055190b19 ("ACPI / property: Add fwnode_get_next_child_node()")', so
>> this should probably go to linux-stable all the way to 4.12
> 
> Period is missed in above sentence.
> 
> I think it make sense to add Fixes: tag.

Thanks Andy for the review. I hesitated to add a fixes tag. The line 
about resetting the adev pointer was indeed removed in the latter 
commit, but there were a slew of other changes done later by Sakari on 
hierarchical _DSD so it's quite complicated to say when this was last 
fully functional.

> 
> Nevertheless,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Thank you for fixing this interesting issue!
> 
>>
>> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>> ---
>>   drivers/acpi/property.c | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
>> index 5815356ea6ad..efc74f912f39 100644
>> --- a/drivers/acpi/property.c
>> +++ b/drivers/acpi/property.c
>> @@ -943,6 +943,16 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
>>   		const struct acpi_data_node *data = to_acpi_data_node(fwnode);
>>   		struct acpi_data_node *dn;
>>   
>> +		/*
>> +		 * We can have a combination of device and data nodes,
>> +		 * e.g. with hierarchical _DSD properties. Make sure
>> +		 * the adev pointer is restored before going through
>> +		 * data nodes, otherwise we will be looking for
>> +		 * data_nodes below the last device found instead of
>> +		 * the common fwnode shared by device_nodes and
>> +		 * data_nodes
>> +		 */
>> +		adev = to_acpi_device_node(fwnode);
>>   		if (adev)
>>   			head = &adev->data.subnodes;
>>   		else if (data)
>> -- 
>> 2.17.1
>>
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
  2019-04-30 16:41   ` Pierre-Louis Bossart
@ 2019-04-30 16:41     ` Pierre-Louis Bossart
  2019-04-30 16:47     ` Andy Shevchenko
  1 sibling, 0 replies; 10+ messages in thread
From: Pierre-Louis Bossart @ 2019-04-30 16:41 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-acpi, Rafael J . Wysocki, Len Brown, linux-kernel,
	Mika Westerberg

On 4/30/19 11:30 AM, Andy Shevchenko wrote:
> On Tue, Apr 30, 2019 at 10:52:29AM -0500, Pierre-Louis Bossart wrote:
>> When the DSDT tables expose devices with subdevices and a set of
>> hierarchical _DSD properties, the data returned by
>> acpi_get_next_subnode() is incorrect, with the results suggesting a bad
>> pointer assignment. The parser works fine with device_nodes or
>> data_nodes, but not with a combination of the two.
>>
>> The problem is traced to an invalid pointer used when jumping from
>> handling device_nodes to data nodes. The existing code looks for data
>> nodes below the last subdevice found instead of the common root. Fix
>> by forcing the acpi_device pointer to be derived from the same fwnode
>> for the two types of subnodes.
>>
>> This same problem of handling device and data nodes was already fixed
>> in a similar way by 'commit bf4703fdd166 ("ACPI / property: fix data
>> node parsing in acpi_get_next_subnode()")' but broken later by 'commit
>> 34055190b19 ("ACPI / property: Add fwnode_get_next_child_node()")', so
>> this should probably go to linux-stable all the way to 4.12
> 
> Period is missed in above sentence.
> 
> I think it make sense to add Fixes: tag.

Thanks Andy for the review. I hesitated to add a fixes tag. The line 
about resetting the adev pointer was indeed removed in the latter 
commit, but there were a slew of other changes done later by Sakari on 
hierarchical _DSD so it's quite complicated to say when this was last 
fully functional.

> 
> Nevertheless,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Thank you for fixing this interesting issue!
> 
>>
>> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>> ---
>>   drivers/acpi/property.c | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
>> index 5815356ea6ad..efc74f912f39 100644
>> --- a/drivers/acpi/property.c
>> +++ b/drivers/acpi/property.c
>> @@ -943,6 +943,16 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode,
>>   		const struct acpi_data_node *data = to_acpi_data_node(fwnode);
>>   		struct acpi_data_node *dn;
>>   
>> +		/*
>> +		 * We can have a combination of device and data nodes,
>> +		 * e.g. with hierarchical _DSD properties. Make sure
>> +		 * the adev pointer is restored before going through
>> +		 * data nodes, otherwise we will be looking for
>> +		 * data_nodes below the last device found instead of
>> +		 * the common fwnode shared by device_nodes and
>> +		 * data_nodes
>> +		 */
>> +		adev = to_acpi_device_node(fwnode);
>>   		if (adev)
>>   			head = &adev->data.subnodes;
>>   		else if (data)
>> -- 
>> 2.17.1
>>
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
  2019-04-30 16:41   ` Pierre-Louis Bossart
  2019-04-30 16:41     ` Pierre-Louis Bossart
@ 2019-04-30 16:47     ` Andy Shevchenko
  2019-04-30 16:47       ` Andy Shevchenko
  1 sibling, 1 reply; 10+ messages in thread
From: Andy Shevchenko @ 2019-04-30 16:47 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: linux-acpi, Rafael J . Wysocki, Len Brown, linux-kernel,
	Mika Westerberg

On Tue, Apr 30, 2019 at 11:41:50AM -0500, Pierre-Louis Bossart wrote:
> On 4/30/19 11:30 AM, Andy Shevchenko wrote:
> > On Tue, Apr 30, 2019 at 10:52:29AM -0500, Pierre-Louis Bossart wrote:
> > > When the DSDT tables expose devices with subdevices and a set of
> > > hierarchical _DSD properties, the data returned by
> > > acpi_get_next_subnode() is incorrect, with the results suggesting a bad
> > > pointer assignment. The parser works fine with device_nodes or
> > > data_nodes, but not with a combination of the two.
> > > 
> > > The problem is traced to an invalid pointer used when jumping from
> > > handling device_nodes to data nodes. The existing code looks for data
> > > nodes below the last subdevice found instead of the common root. Fix
> > > by forcing the acpi_device pointer to be derived from the same fwnode
> > > for the two types of subnodes.
> > > 
> > > This same problem of handling device and data nodes was already fixed
> > > in a similar way by 'commit bf4703fdd166 ("ACPI / property: fix data
> > > node parsing in acpi_get_next_subnode()")' but broken later by 'commit
> > > 34055190b19 ("ACPI / property: Add fwnode_get_next_child_node()")', so
> > > this should probably go to linux-stable all the way to 4.12
> > 
> > Period is missed in above sentence.
> > 
> > I think it make sense to add Fixes: tag.
> 
> Thanks Andy for the review. I hesitated to add a fixes tag. The line about
> resetting the adev pointer was indeed removed in the latter commit, but
> there were a slew of other changes done later by Sakari on hierarchical _DSD
> so it's quite complicated to say when this was last fully functional.

I see, btw, you forgot to add Sakari to Cc list, he is doing a lot lately WRT
device properties.

> > Nevertheless,
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > 
> > Thank you for fixing this interesting issue!

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
  2019-04-30 16:47     ` Andy Shevchenko
@ 2019-04-30 16:47       ` Andy Shevchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2019-04-30 16:47 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: linux-acpi, Rafael J . Wysocki, Len Brown, linux-kernel,
	Mika Westerberg

On Tue, Apr 30, 2019 at 11:41:50AM -0500, Pierre-Louis Bossart wrote:
> On 4/30/19 11:30 AM, Andy Shevchenko wrote:
> > On Tue, Apr 30, 2019 at 10:52:29AM -0500, Pierre-Louis Bossart wrote:
> > > When the DSDT tables expose devices with subdevices and a set of
> > > hierarchical _DSD properties, the data returned by
> > > acpi_get_next_subnode() is incorrect, with the results suggesting a bad
> > > pointer assignment. The parser works fine with device_nodes or
> > > data_nodes, but not with a combination of the two.
> > > 
> > > The problem is traced to an invalid pointer used when jumping from
> > > handling device_nodes to data nodes. The existing code looks for data
> > > nodes below the last subdevice found instead of the common root. Fix
> > > by forcing the acpi_device pointer to be derived from the same fwnode
> > > for the two types of subnodes.
> > > 
> > > This same problem of handling device and data nodes was already fixed
> > > in a similar way by 'commit bf4703fdd166 ("ACPI / property: fix data
> > > node parsing in acpi_get_next_subnode()")' but broken later by 'commit
> > > 34055190b19 ("ACPI / property: Add fwnode_get_next_child_node()")', so
> > > this should probably go to linux-stable all the way to 4.12
> > 
> > Period is missed in above sentence.
> > 
> > I think it make sense to add Fixes: tag.
> 
> Thanks Andy for the review. I hesitated to add a fixes tag. The line about
> resetting the adev pointer was indeed removed in the latter commit, but
> there were a slew of other changes done later by Sakari on hierarchical _DSD
> so it's quite complicated to say when this was last fully functional.

I see, btw, you forgot to add Sakari to Cc list, he is doing a lot lately WRT
device properties.

> > Nevertheless,
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > 
> > Thank you for fixing this interesting issue!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
  2019-04-30 15:52 [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode() Pierre-Louis Bossart
  2019-04-30 15:52 ` Pierre-Louis Bossart
  2019-04-30 16:30 ` Andy Shevchenko
@ 2019-05-01  8:11 ` Rafael J. Wysocki
  2019-05-01  8:11   ` Rafael J. Wysocki
  2 siblings, 1 reply; 10+ messages in thread
From: Rafael J. Wysocki @ 2019-05-01  8:11 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: ACPI Devel Maling List, Rafael J . Wysocki, Len Brown,
	Linux Kernel Mailing List, Mika Westerberg, Andy Shevchenko

On Tue, Apr 30, 2019 at 5:52 PM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
>
> When the DSDT tables expose devices with subdevices and a set of
> hierarchical _DSD properties, the data returned by
> acpi_get_next_subnode() is incorrect, with the results suggesting a bad
> pointer assignment. The parser works fine with device_nodes or
> data_nodes, but not with a combination of the two.
>
> The problem is traced to an invalid pointer used when jumping from
> handling device_nodes to data nodes. The existing code looks for data
> nodes below the last subdevice found instead of the common root. Fix
> by forcing the acpi_device pointer to be derived from the same fwnode
> for the two types of subnodes.
>
> This same problem of handling device and data nodes was already fixed
> in a similar way by 'commit bf4703fdd166 ("ACPI / property: fix data
> node parsing in acpi_get_next_subnode()")' but broken later by 'commit
> 34055190b19 ("ACPI / property: Add fwnode_get_next_child_node()")', so
> this should probably go to linux-stable all the way to 4.12
>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Applied with the Andy's R-by, but I reformatted the comment to take
fewer lines of code.

Thanks!

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode()
  2019-05-01  8:11 ` Rafael J. Wysocki
@ 2019-05-01  8:11   ` Rafael J. Wysocki
  0 siblings, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2019-05-01  8:11 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: ACPI Devel Maling List, Rafael J . Wysocki, Len Brown,
	Linux Kernel Mailing List, Mika Westerberg, Andy Shevchenko

On Tue, Apr 30, 2019 at 5:52 PM Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
>
> When the DSDT tables expose devices with subdevices and a set of
> hierarchical _DSD properties, the data returned by
> acpi_get_next_subnode() is incorrect, with the results suggesting a bad
> pointer assignment. The parser works fine with device_nodes or
> data_nodes, but not with a combination of the two.
>
> The problem is traced to an invalid pointer used when jumping from
> handling device_nodes to data nodes. The existing code looks for data
> nodes below the last subdevice found instead of the common root. Fix
> by forcing the acpi_device pointer to be derived from the same fwnode
> for the two types of subnodes.
>
> This same problem of handling device and data nodes was already fixed
> in a similar way by 'commit bf4703fdd166 ("ACPI / property: fix data
> node parsing in acpi_get_next_subnode()")' but broken later by 'commit
> 34055190b19 ("ACPI / property: Add fwnode_get_next_child_node()")', so
> this should probably go to linux-stable all the way to 4.12
>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Applied with the Andy's R-by, but I reformatted the comment to take
fewer lines of code.

Thanks!

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-05-01  8:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-30 15:52 [PATCH] ACPI / property: fix handling of data_nodes in acpi_get_next_subnode() Pierre-Louis Bossart
2019-04-30 15:52 ` Pierre-Louis Bossart
2019-04-30 16:30 ` Andy Shevchenko
2019-04-30 16:30   ` Andy Shevchenko
2019-04-30 16:41   ` Pierre-Louis Bossart
2019-04-30 16:41     ` Pierre-Louis Bossart
2019-04-30 16:47     ` Andy Shevchenko
2019-04-30 16:47       ` Andy Shevchenko
2019-05-01  8:11 ` Rafael J. Wysocki
2019-05-01  8:11   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox