2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-28 07:04:00 +08:00
linux-next/drivers/power
Krzysztof Kozlowski 7f1a57fdd6 power_supply: Fix possible NULL pointer dereference on early uevent
Don't call the power_supply_changed() from power_supply_register() when
parent is still probing because it may lead to accessing parent too
early.

In bq27x00_battery this caused NULL pointer exception because uevent of
power_supply_changed called back the the get_property() method provided
by the driver. The get_property() method accessed pointer which should
be returned by power_supply_register().

Starting from bq27x00_battery_probe():
  di->bat = power_supply_register()
    power_supply_changed()
      kobject_uevent()
        power_supply_uevent()
          power_supply_show_property()
            power_supply_get_property()
              bq27x00_battery_get_property()
                dereference of di->bat which is NULL here

The dereference of di->bat (value returned by power_supply_register())
is the currently visible problem. However calling back the methods
provided by driver before ending the probe may lead to accessing other
driver-related data which is not yet initialized.

The call to power_supply_changed() is postponed till probing ends -
mutex of parent device is released.

Reported-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: 297d716f62 ("power_supply: Change ownership from driver to core")
Tested-By: Dr. H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-05-21 15:41:09 +02:00
..
avs PM / AVS: rockchip-io: add driver handling Rockchip io domains 2014-09-25 09:57:23 -07:00
reset power: reset: Add MFD_SYSCON depends for brcmstb 2015-05-01 22:48:28 +02:00
88pm860x_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
88pm860x_charger.c power_supply: 88pm860x_charger: Fix possible NULL pointer dereference and use of initialized variable 2015-03-20 12:46:04 +01:00
ab8500_bmdata.c ab8500_bmdata: Export abx500_res_to_temp tables for hwmon 2013-04-16 17:38:10 -07:00
ab8500_btemp.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
ab8500_charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
ab8500_fg.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
abx500_chargalg.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
apm_power.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
axp288_fuel_gauge.c axp288_fuel_gauge: Add original author details 2015-04-30 17:19:55 +02:00
bq27x00_battery.c power: bq27x00_battery: Add missing MODULE_ALIAS 2015-05-01 23:01:48 +02:00
bq2415x_charger.c power_supply: bq2415x_charger: Decrement the power supply's device reference counter 2015-03-13 23:15:54 +01:00
bq24190_charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
bq24735-charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
charger-manager.c power_supply: charger-manager: Fix dereferencing of ERR_PTR 2015-03-24 13:40:14 +01:00
collie_battery.c power_supply: fix oops in collie_battery driver 2015-04-30 17:39:40 +02:00
da9030_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
da9052-battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
da9150-charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
ds2760_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
ds2780_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
ds2781_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
ds2782_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
generic-adc-battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
goldfish_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
gpio-charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
intel_mid_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
ipaq_micro_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
isp1704_charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
jz4740-battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
Kconfig X-Power AXP288 PMIC Fuel Gauge Driver 2015-03-07 20:08:58 +01:00
lp8727_charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
lp8788-charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
ltc2941-battery-gauge.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
Makefile X-Power AXP288 PMIC Fuel Gauge Driver 2015-03-07 20:08:58 +01:00
max8903_charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
max8925_power.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
max8997_charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
max8998_charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
max14577_charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
max17040_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
max17042_battery.c power: max17042_battery: add missed blank 2015-04-06 17:46:46 +02:00
max77693_charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
olpc_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
pcf50633-charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
pda_power.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
pm2301_charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
pm2301_charger.h power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
pmu_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
power_supply_core.c power_supply: Fix possible NULL pointer dereference on early uevent 2015-05-21 15:41:09 +02:00
power_supply_leds.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
power_supply_sysfs.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
power_supply.h device.h: cleanup users outside of linux/include (C files) 2012-03-11 14:27:37 -04:00
rt5033_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
rx51_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
s3c_adc_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
sbs-battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
smb347-charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
test_power.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
tosa_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
tps65090-charger.c power: constify of_device_id array 2015-03-20 13:23:06 +01:00
twl4030_charger.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
twl4030_madc_battery.c power: twl4030_madc_battery: Add missing MODULE_ALIAS 2015-04-06 19:39:57 +02:00
wm97xx_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
wm831x_backup.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
wm831x_power.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
wm8350_power.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00
z2_battery.c power_supply: Change ownership from driver to core 2015-03-13 23:15:51 +01:00