]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register()...
authorLan Tianyu <tianyu.lan@intel.com>
Fri, 20 Jul 2012 05:29:16 +0000 (13:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Aug 2012 15:27:42 +0000 (08:27 -0700)
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.

https://bugzilla.redhat.com/show_bug.cgi?id=772730

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/acpi/ac.c

index 58c3f74bd84cb2158bdd4a69e49931cee33c2ede..958205046e06e12e819f5a6f74062d9be72803a7 100644 (file)
@@ -292,7 +292,9 @@ static int acpi_ac_add(struct acpi_device *device)
        ac->charger.properties = 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),