Based on <https://bugzilla.kernel.org/show_bug.cgi?id=46481>, the
following commit should be cherry-picked for stable series < 3.6:

commit dfb117b3e50c52c7b3416db4a4569224b8db80bb
Author: Bjorn Helgaas <bhelg...@google.com>
Date:   Wed Jun 20 16:18:29 2012 -0600

    PCI: acpiphp: check whether _ADR evaluation succeeded

It applies cleanly to 3.2.y and presumably also to later stable
branches.  I've attached a version that applies to 2.6.32.y and 3.0.y,
and presumably also to the intermediate stable branches.  Only 3.2.y has
actually been tested with this, though.

Ben.

-- 
Ben Hutchings
You can't have everything.  Where would you put it?
From e799a33800ecc8028a7d0bcaf7d986f8ce53f8da Mon Sep 17 00:00:00 2001
From: Bjorn Helgaas <bhelg...@google.com>
Date: Wed, 20 Jun 2012 16:18:29 -0600
Subject: [PATCH] PCI: acpiphp: check whether _ADR evaluation succeeded

commit dfb117b3e50c52c7b3416db4a4569224b8db80bb upstream.

Check whether we evaluated _ADR successfully.  Previously we ignored
failure, so we would have used garbage data from the stack as the device
and function number.

We return AE_OK so that we ignore only this slot and continue looking
for other slots.

Found by Coverity (CID 113981).

Signed-off-by: Bjorn Helgaas <bhelg...@google.com>
[bwh: Backported to 2.6.32/3.0: adjust context]
Signed-off-by: Ben Hutchings <b...@decadent.org.uk>
---
 drivers/pci/hotplug/acpiphp_glue.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index a70fa89..7bd3694 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -131,7 +131,12 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
 	if (!acpi_pci_check_ejectable(pbus, handle) && !is_dock_device(handle))
 		return AE_OK;
 
-	acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
+	status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
+	if (ACPI_FAILURE(status)) {
+		warn("can't evaluate _ADR (%#x)\n", status);
+		return AE_OK;
+	}
+
 	device = (adr >> 16) & 0xffff;
 	function = adr & 0xffff;
 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to