diff options
author | Zheng Wang <zyytlz.wz@163.com> | 2023-03-11 20:46:50 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-30 13:49:01 +0300 |
commit | 47b2e1a67e6da172bb4cf69ef9dafde4458bde5f (patch) | |
tree | 721c729693669d4fdd06c3a1a2bb2ae0dc6c5c3b /arch | |
parent | 84bdb3b76b07f2e62183913a1f5da2d4aa25580a (diff) | |
download | linux-47b2e1a67e6da172bb4cf69ef9dafde4458bde5f.tar.xz |
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: c1a281e34dae ("power: Add support for DA9150 Charger")
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch')
0 files changed, 0 insertions, 0 deletions