linux-uconsole/drivers/power
Sven Van Asbroeck d12fbc55c1 power: supply: ltc2941-battery-gauge: fix use-after-free
commit a60ec78d30 upstream.

This driver's remove path calls cancel_delayed_work().
However, that function does not wait until the work function
finishes. This could mean that the work function is still
running after the driver's remove function has finished,
which would result in a use-after-free.

Fix by calling cancel_delayed_work_sync(), which ensures that
that the work is properly cancelled, no longer running, and
unable to re-schedule itself.

This issue was detected with the help of Coccinelle.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-11 04:34:02 -08:00
..
avs PM / AVS: SmartReflex: NULL check before some freeing functions is not needed 2019-12-05 09:20:02 +01:00
reset power: reset: at91-poweroff: do not procede if at91_shdwc is allocated 2019-11-20 18:46:46 +01:00
supply power: supply: ltc2941-battery-gauge: fix use-after-free 2020-02-11 04:34:02 -08:00
Kconfig power: move power supply drivers to power/supply 2016-08-11 01:11:03 +02:00
Makefile power: move power supply drivers to power/supply 2016-08-11 01:11:03 +02:00