aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-29 18:23:09 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-07-29 18:23:09 -0400
commitb6328a07bd6b3d31b64f85864fe74f3b08c010ca (patch)
treea4dc262168dfbb6cf27112688b7bbdcabfcc50b9
parent64aa90f26c06e1cb2aacfb98a7d0eccfbd6c1a91 (diff)
ACPI / PNP: Fix acpi_pnp_match()
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 202317a573b2 (ACPI / scan: Add acpi_device objects for all device nodes in the namespace). Fixes: 202317a573b2 (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>
-rw-r--r--drivers/pnp/pnpacpi/core.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index b81448b2c75d..a5c6cb773e5f 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -319,8 +319,7 @@ static int __init acpi_pnp_match(struct device *dev, void *_pnp)
319 struct pnp_dev *pnp = _pnp; 319 struct pnp_dev *pnp = _pnp;
320 320
321 /* true means it matched */ 321 /* true means it matched */
322 return !acpi->physical_node_count 322 return pnp->data == acpi;
323 && compare_pnp_id(pnp->id, acpi_device_hid(acpi));
324} 323}
325 324
326static struct acpi_device * __init acpi_pnp_find_companion(struct device *dev) 325static struct acpi_device * __init acpi_pnp_find_companion(struct device *dev)