diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-30 13:05:05 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-12-17 10:49:04 -0800 |
commit | cb2bf59bccbdb431ac3020e0ef31489d77b510b5 (patch) | |
tree | 45a0eb2e201fe79a903544ee5bd59767f799f5b7 | |
parent | fd013d71a5bcb2b96275ac4664f73afa00992b88 (diff) | |
download | kernel_samsung_aries-cb2bf59bccbdb431ac3020e0ef31489d77b510b5.zip kernel_samsung_aries-cb2bf59bccbdb431ac3020e0ef31489d77b510b5.tar.gz kernel_samsung_aries-cb2bf59bccbdb431ac3020e0ef31489d77b510b5.tar.bz2 |
ACPI / PNP: Do not crash due to stale pointer use during system resume
commit a6b5e88c0e42093b9057856f35770966c8c591e3 upstream.
During resume from system suspend the 'data' field of
struct pnp_dev in pnpacpi_set_resources() may be a stale pointer,
due to removal of the associated ACPI device node object in the
previous suspend-resume cycle. This happens, for example, if a
dockable machine is booted in the docking station and then suspended
and resumed and suspended again. If that happens,
pnpacpi_build_resource_template() called from pnpacpi_set_resources()
attempts to use that pointer and crashes.
However, pnpacpi_set_resources() actually checks the device's ACPI
handle, attempts to find the ACPI device node object attached to it
and returns an error code if that fails, so in fact it knows what the
correct value of dev->data should be. Use this observation to update
dev->data with the correct value if necessary and dump a call trace
if that's the case (once).
We still need to fix the root cause of this issue, but preventing
systems from crashing because of it is an improvement too.
Reported-and-tested-by: Zdenek Kabelac <zdenek.kabelac@gmail.com>
References: https://bugzilla.kernel.org/show_bug.cgi?id=51071
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 5f44b55..3f84f84 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c @@ -94,6 +94,9 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) return -ENODEV; } + if (WARN_ON_ONCE(acpi_dev != dev->data)) + dev->data = acpi_dev; + ret = pnpacpi_build_resource_template(dev, &buffer); if (ret) return ret; |