[lkml]   [2012]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[ 049/109] ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check
    From: Greg KH <>

    3.4-stable review patch. If anyone has any objections, please let me know.


    From: Lan Tianyu <>

    commit f197ac13f6eeb351b31250b9ab7d0da17434ea36 upstream.

    In the ac.c, power_supply_register()'s return value is not checked.

    As a result, the driver's add() ops may return success
    even though the device failed to initialize.

    For example, some BIOS may describe two ACADs in the same DSDT.
    The second ACAD device will fail to register,
    but ACPI driver's add() ops returns sucessfully.
    The ACPI device will receive ACPI notification and cause OOPS.

    Signed-off-by: Lan Tianyu <>
    Signed-off-by: Len Brown <>
    Signed-off-by: Greg Kroah-Hartman <>

    drivers/acpi/ac.c | 4 +++-
    1 file changed, 3 insertions(+), 1 deletion(-)

    --- a/drivers/acpi/ac.c
    +++ b/drivers/acpi/ac.c
    @@ -292,7 +292,9 @@ static int acpi_ac_add(struct acpi_devic
    ac-> = ac_props;
    ac->charger.num_properties = ARRAY_SIZE(ac_props);
    ac->charger.get_property = get_ac_property;
    - power_supply_register(&ac->device->dev, &ac->charger);
    + result = power_supply_register(&ac->device->dev, &ac->charger);
    + if (result)
    + goto end;

    printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
    acpi_device_name(device), acpi_device_bid(device),

     \ /
      Last update: 2012-08-08 02:01    [W:0.023 / U:4.244 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site