linux/drivers/power/supply
Zheng Wang 06615d11cc power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition
In da9150_charger_probe, &charger->otg_work is bound with
da9150_charger_otg_work. da9150_charger_otg_ncb may be
called to start the work.

If we remove the module which will call da9150_charger_remove
to make cleanup, there may be a unfinished work. The possible
sequence is as follows:

Fix it by canceling the work before cleanup in the da9150_charger_remove

CPU0                  CPUc1

                    |da9150_charger_otg_work
da9150_charger_remove      |
power_supply_unregister  |
device_unregister   |
power_supply_dev_release|
kfree(psy)          |
                    |
                    | 	power_supply_changed(charger->usb);
                    |   //use

Fixes: c1a281e34d ("power: Add support for DA9150 Charger")
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-03-12 23:28:04 +01:00
..
88pm860x_battery.c power: supply: 88pm860x_battery: Remove unnecessary int for long long 2021-04-02 14:14:58 +02:00
88pm860x_charger.c power: supply: 88pm860x: simplify using devm 2022-11-17 23:47:23 +01:00
ab8500_bmdata.c power: supply: ab8500: Standardize BTI resistance 2022-02-28 11:34:31 +01:00
ab8500_btemp.c power: supply: ab8500: Defer thermal zone probe 2022-11-01 01:00:32 +01:00
ab8500_chargalg.c power: supply: ab8500: remove unused static local variable 2022-10-05 23:47:04 +02:00
ab8500_charger.c power: supply: ab8500: Fix error handling in ab8500_charger_init() 2022-11-26 23:14:32 +01:00
ab8500_fg.c power: supply: use sysfs_emit() instead of sprintf() for sysfs show() 2023-01-02 09:13:37 +01:00
ab8500-bm.h power: supply: ab8500: Standardize BTI resistance 2022-02-28 11:34:31 +01:00
ab8500-chargalg.h power: supply: ab8500: Drop external charger leftovers 2022-07-17 00:51:35 +02:00
acer_a500_battery.c power: supply: Add battery gauge driver for Acer Iconia Tab A500 2021-01-14 23:39:43 +01:00
act8945a_charger.c power: supply: act8945a: correct kerneldoc 2021-04-20 16:18:08 +02:00
adp5061.c power: supply: adp5061: Convert to i2c's .probe_new() 2022-11-20 20:12:16 +01:00
apm_power.c
axp20x_ac_power.c power: supply: axp20x_ac_power: fix platform_get_irq.cocci warning 2022-03-04 22:20:32 +01:00
axp20x_battery.c power: supply: axp20x_battery: properly report current when discharging 2022-02-01 11:18:47 +01:00
axp20x_usb_power.c power: supply: axp20x_usb_power: fix platform_get_irq.cocci warnings 2022-03-04 22:20:32 +01:00
axp288_charger.c extcon: Fix extcon_get_extcon_dev() error handling 2022-05-13 17:03:40 +09:00
axp288_fuel_gauge.c power: supply: axp288_fuel_gauge: Added check for negative values 2023-03-10 00:20:43 +01:00
bd99954-charger.c power: supply: bd99954: Use LINEAR_RANGE() 2022-11-01 01:01:50 +01:00
bd99954-charger.h
bq27xxx_battery_hdq.c power supply and reset changes for the v5.10 series 2020-10-20 10:56:34 -07:00
bq27xxx_battery_i2c.c power: supply: bq27xxx: Convert to i2c's .probe_new() 2022-11-20 20:12:16 +01:00
bq27xxx_battery.c power: supply: bq27xxx: fix reporting critical level 2023-02-03 13:35:04 +01:00
bq256xx_charger.c power: supply: bq256xx: Init ichg/vbat value with chip default value 2023-02-03 13:32:01 +01:00
bq2415x_charger.c power: supply: use sysfs_emit() instead of sprintf() for sysfs show() 2023-01-02 09:13:37 +01:00
bq2515x_charger.c power: supply: bq2515x: Convert to i2c's .probe_new() 2022-11-20 20:12:16 +01:00
bq24190_charger.c power: supply: bq24190: Fix use after free bug in bq24190_remove due to race condition 2023-03-10 00:35:20 +01:00
bq24257_charger.c power: supply: use sysfs_emit() instead of scnprintf() for sysfs show() 2023-01-02 08:54:07 +01:00
bq24735-charger.c power: supply: bq24735: Convert to i2c's .probe_new() 2022-11-20 20:12:16 +01:00
bq25890_charger.c power: supply: bq25890: Add new linux,iinlim-percentage property 2023-01-28 18:07:22 +01:00
bq25980_charger.c power: supply: bq25980: Convert to i2c's .probe_new() 2022-11-20 20:12:16 +01:00
bq25980_charger.h power: supply: bq25980: Add support for the BQ259xx family 2020-10-04 01:54:35 +02:00
charger-manager.c power: supply: use sysfs_emit() instead of sprintf() for sysfs show() 2023-01-02 09:13:37 +01:00
collie_battery.c power: supply: collie_battery: Convert to GPIO descriptors (part 2) 2023-02-03 13:28:59 +01:00
cpcap-battery.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULE 2022-06-10 14:51:36 +02:00
cpcap-charger.c power: supply: cpcap-charger: fix repeated words in comments 2022-09-11 10:52:05 +02:00
cros_peripheral_charger.c power: supply: cros_peripheral: Use struct_size() helper in kzalloc() 2022-06-09 22:03:27 +02:00
cros_usbpd-charger.c power: supply: cros_usbpd: reclassify "default case!" as debug 2023-03-10 00:20:43 +01:00
cw2015_battery.c power: supply: cw2015: Fix potential null-ptr-deref in cw_bat_probe() 2022-11-24 23:00:00 +01:00
da9030_battery.c
da9052-battery.c
da9150-charger.c power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition 2023-03-12 23:28:04 +01:00
da9150-fg.c power: supply: da9150-fg: Remove unnecessary print function dev_err() 2022-03-04 22:20:33 +01:00
ds2760_battery.c ARM: pxa: remove unused board files 2023-01-20 11:23:44 +01:00
ds2780_battery.c power: supply: use sysfs_emit() instead of sprintf() for sysfs show() 2023-01-02 09:13:37 +01:00
ds2781_battery.c power: supply: use sysfs_emit() instead of sprintf() for sysfs show() 2023-01-02 09:13:37 +01:00
ds2782_battery.c power: supply: ds2782: Convert to i2c's .probe_new() 2022-11-20 20:12:16 +01:00
generic-adc-battery.c power: supply: generic-adc-battery: fix possible use-after-free in gab_remove() 2021-04-08 14:35:19 +02:00
goldfish_battery.c power: supply: Remove unnecessary print function dev_err() 2022-06-09 20:27:21 +02:00
gpio-charger.c power: supply: gpio-charger: add charge-current-limit feature 2020-08-27 21:13:23 +02:00
ingenic-battery.c power: supply_core: Pass pointer to battery info 2022-01-03 18:53:10 +01:00
ip5xxx_power.c power: supply: ip5xxx: Fix integer overflow in current_now calculation 2022-11-01 00:02:36 +01:00
ipaq_micro_battery.c
isp1704_charger.c
Kconfig ARM: SoC drivers for 6.3 2023-02-27 10:04:49 -08:00
lego_ev3_battery.c
lp8727_charger.c power: supply: lp8727: Convert to i2c's .probe_new() 2022-11-20 20:12:16 +01:00
lp8788-charger.c power: supply: use sysfs_emit() instead of scnprintf() for sysfs show() 2023-01-02 08:54:07 +01:00
lt3651-charger.c
ltc2941-battery-gauge.c power: supply: ltc2941: Convert to i2c's .probe_new() 2022-11-20 20:12:16 +01:00
ltc4162-l-charger.c power: supply: use sysfs_emit() instead of sprintf() for sysfs show() 2023-01-02 09:13:37 +01:00
Makefile ARM: SoC drivers for 6.3 2023-02-27 10:04:49 -08:00
max1721x_battery.c power: supply: max1721x: Use strscpy() is more robust and safer 2023-02-03 13:58:41 +01:00
max8903_charger.c power: supply: max8903: Convert to GPIO descriptors 2021-01-12 23:23:49 +01:00
max8925_power.c
max8997_charger.c extcon: Fix extcon_get_extcon_dev() error handling 2022-05-13 17:03:40 +09:00
max8998_charger.c
max14577_charger.c power: supply: use sysfs_emit() instead of scnprintf() for sysfs show() 2023-01-02 08:54:07 +01:00
max14656_charger_detector.c power: supply: max14656: Convert to i2c's .probe_new() 2022-11-20 20:12:16 +01:00
max17040_battery.c power: supply: max17040: Convert to i2c's .probe_new() 2022-11-20 20:12:16 +01:00
max17042_battery.c power: supply: max17042_battery: Convert to i2c's .probe_new() 2022-11-20 20:12:16 +01:00
max77650-charger.c power: supply: max77650: Make max77650_charger_disable() return void 2023-02-13 21:20:39 +01:00
max77693_charger.c power: supply: use sysfs_emit() instead of scnprintf() for sysfs show() 2023-01-02 08:54:07 +01:00
max77976_charger.c power: supply: max77976: update Luca Ceresoli's e-mail address 2022-06-09 19:27:14 +02:00
mp2629_charger.c power: supply: use sysfs_emit() instead of sprintf() for sysfs show() 2023-01-02 09:13:37 +01:00
mt6360_charger.c power: supply: mt6360: Use LINEAR_RANGE_IDX() 2022-11-01 01:01:50 +01:00
mt6370-charger.c power: supply: mt6370: Fix return value check in mt6370_chg_probe() 2022-10-01 22:17:45 +02:00
olpc_battery.c power: supply: use sysfs_emit() instead of sprintf() for sysfs show() 2023-01-02 09:13:37 +01:00
pcf50633-charger.c power: supply: use sysfs_emit() instead of sprintf() for sysfs show() 2023-01-02 09:13:37 +01:00
pmu_battery.c
power_supply_core.c power: supply: fix null pointer check order in __power_supply_register 2023-02-25 01:15:03 +01:00
power_supply_hwmon.c power: supply: core: Simplify hwmon memory allocation 2022-02-11 19:45:52 +01:00
power_supply_leds.c power: supply: leds: explicitly include linux/leds.h 2023-02-15 23:47:22 +01:00
power_supply_sysfs.c power: supply: use sysfs_emit() instead of sprintf() for sysfs show() 2023-01-02 09:13:37 +01:00
power_supply.h driver core: make struct class.dev_uevent() take a const * 2022-11-24 17:12:15 +01:00
qcom_battmgr.c power: supply: qcom_battmgr: remove bogus do_div() 2023-03-01 10:41:18 -08:00
qcom_smbb.c power: supply: qcom_smbb: support pm8226 2021-11-30 11:34:27 +01:00
rk817_charger.c power: supply: rk817: Fix unsigned comparison with less than zero 2023-03-10 00:20:43 +01:00
rn5t618_power.c power: supply: rn5t618: Add voltage_now property 2021-08-13 18:38:17 +02:00
rt5033_battery.c power: supply: rt5033_battery: Convert to i2c's .probe_new() 2022-11-20 20:12:17 +01:00
rt9455_charger.c power: supply: rt9455: Convert to i2c's .probe_new() 2022-11-20 20:12:17 +01:00
rt9467-charger.c power: supply: rt9467: Fix spelling mistake "attache" -> "attach" 2023-02-13 21:29:33 +01:00
rt9471.c power: supply: rt9471: fix using wrong ce_gpio in rt9471_probe() 2023-02-13 21:28:56 +01:00
rx51_battery.c
samsung-sdi-battery.c power: supply: samsung-sdi-battery: Add missing charge restart voltages 2022-04-13 12:05:22 +02:00
samsung-sdi-battery.h power: supply: Static data for Samsung batteries 2022-03-04 22:20:18 +01:00
sbs-battery.c power: supply: sbs-battery: add support for time_to_empty_now attribute 2021-08-06 23:48:51 +02:00
sbs-charger.c power: supply: sbs: Convert to i2c's .probe_new() 2022-11-20 20:12:17 +01:00
sbs-manager.c power: supply: sbs-manager: Convert to i2c's .probe_new() 2022-11-20 20:12:17 +01:00
sc27xx_fuel_gauge.c power: supply_core: Pass pointer to battery info 2022-01-03 18:53:10 +01:00
sc2731_charger.c power: supply_core: Pass pointer to battery info 2022-01-03 18:53:10 +01:00
smb347-charger.c power: supply: smb347: Convert to i2c's .probe_new() 2022-11-20 20:12:17 +01:00
surface_battery.c platform/surface: aggregator: Enforce use of target-ID enum in device ID macros 2023-02-02 22:48:20 +01:00
surface_charger.c platform/surface: aggregator: Enforce use of target-ID enum in device ID macros 2023-02-02 22:48:20 +01:00
test_power.c power: supply: test-power: use strscpy() instead of strncpy() 2023-02-03 13:43:48 +01:00
tps65090-charger.c power: supply: Use IRQF_ONESHOT 2021-03-22 14:54:24 +01:00
tps65217_charger.c power: supply: tps65217: Fix comments typo 2022-09-11 12:09:10 +02:00
twl4030_charger.c power: supply: use sysfs_emit() instead of scnprintf() for sysfs show() 2023-01-02 08:54:07 +01:00
twl4030_madc_battery.c
ucs1002_power.c power: supply: ucs1002: Convert to i2c's .probe_new() 2022-11-20 20:12:17 +01:00
ug3105_battery.c power: supply: ug3105_battery: Add driver for uPI uG3105 battery monitor 2022-02-11 19:08:35 +01:00
wilco-charger.c
wm97xx_battery.c power: supply: wm97xx_battery: Convert to GPIO descriptor 2021-01-13 22:25:07 +01:00
wm831x_backup.c
wm831x_power.c power: supply: wm831x_power: fix spelling mistake on function name 2021-10-02 17:31:15 +02:00
wm8350_power.c power: supply: use sysfs_emit() instead of sprintf() for sysfs show() 2023-01-02 09:13:37 +01:00