lkml.org 
[lkml]   [2012]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[ 009/120] PCI: acpiphp: check whether _ADR evaluation succeeded
    Date
    3.4-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Bjorn Helgaas <bhelgaas@google.com>

    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 <bhelgaas@google.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/pci/hotplug/acpiphp_glue.c | 13 +++++++++----
    1 file changed, 9 insertions(+), 4 deletions(-)

    --- a/drivers/pci/hotplug/acpiphp_glue.c
    +++ b/drivers/pci/hotplug/acpiphp_glue.c
    @@ -132,6 +132,15 @@ register_slot(acpi_handle handle, u32 lv
    if (!acpi_pci_check_ejectable(pbus, handle) && !is_dock_device(handle))
    return AE_OK;

    + 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;
    +
    pdev = pbus->self;
    if (pdev && pci_is_pcie(pdev)) {
    tmp = acpi_find_root_bridge_handle(pdev);
    @@ -144,10 +153,6 @@ register_slot(acpi_handle handle, u32 lv
    }
    }

    - acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
    - device = (adr >> 16) & 0xffff;
    - function = adr & 0xffff;
    -
    newfunc = kzalloc(sizeof(struct acpiphp_func), GFP_KERNEL);
    if (!newfunc)
    return AE_NO_MEMORY;



    \
     
     \ /
      Last update: 2012-10-11 04:01    [W:4.111 / U:0.236 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site