Skip to content

Commit

Permalink
ACPI / PNP: Fix acpi_pnp_match()
Browse files Browse the repository at this point in the history
The acpi_pnp_match() function is used for finding the ACPI device
object that should be associated with the given PNP device.
Unfortunately, the check used by that function is not strict enough
and may cause success to be returned for a wrong ACPI device object.

To fix that, use the observation that the pointer to the ACPI
device object in question is already stored in the data field
in struct pnp_dev, so acpi_pnp_match() can simply use that
field to do its job.

This problem was uncovered in 3.14 by commit 202317a (ACPI / scan:
Add acpi_device objects for all device nodes in the namespace).

Fixes: 202317a (ACPI / scan: Add acpi_device objects for all device nodes in the namespace)
Reported-and-tested-by: Vinson Lee <vlee@twopensource.com>
Cc: 3.14+ <stable@vger.kernel.org> # 3.14+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Rafael J. Wysocki committed Jul 29, 2014
1 parent 64aa90f commit b6328a0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/pnp/pnpacpi/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,7 @@ static int __init acpi_pnp_match(struct device *dev, void *_pnp)
struct pnp_dev *pnp = _pnp;

/* true means it matched */
return !acpi->physical_node_count
&& compare_pnp_id(pnp->id, acpi_device_hid(acpi));
return pnp->data == acpi;
}

static struct acpi_device * __init acpi_pnp_find_companion(struct device *dev)
Expand Down

0 comments on commit b6328a0

Please sign in to comment.