android_kernel_motorola_sm6375/drivers/power
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Zheng Wang 6fe078c286 power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition
[ Upstream commit 06615d11cc78162dfd5116efb71f29eb29502d37 ]

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 <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2023-04-05 11:16:36 +02:00
..
avs soc: ti: smartreflex: Fix PM disable depth imbalance in omap_sr_probe 2023-01-18 11:40:50 +01:00
reset power/reset: arm-versatile: Fix refcount leak in versatile_reboot_probe 2022-07-29 17:14:10 +02:00
supply power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition 2023-04-05 11:16:36 +02:00
Kconfig
Makefile