linux-stable/drivers/power
Sven Van Asbroeck 49a7ee280c power: supply: max14656: fix potential use-before-alloc
[ Upstream commit 0cd0e49711 ]

Call order on probe():
- max14656_hw_init() enables interrupts on the chip
- devm_request_irq() starts processing interrupts, isr
  could be called immediately
-    isr: schedules delayed work (irq_work)
-    irq_work: calls power_supply_changed()
- devm_power_supply_register() registers the power supply

Depending on timing, it's possible that power_supply_changed()
is called on an unregistered power supply structure.

Fix by registering the power supply before requesting the irq.

Cc: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-06-15 11:54:57 +02:00
..
avs PM / AVS: rockchip-io: add io selectors and supplies for RV1108 2017-08-25 01:45:23 +02:00
reset power: vexpress: fix corruption in notifier registration 2018-10-03 17:00:46 -07:00
supply power: supply: max14656: fix potential use-before-alloc 2019-06-15 11:54:57 +02: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