diff options
author | Sudeep Holla <sudeep.holla@arm.com> | 2018-06-18 17:54:32 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2018-07-06 16:23:45 +0200 |
commit | 09bebb1adb21ecd04adf7ccb3b06f73e3a851e93 (patch) | |
tree | 7e1bf3b8de7c95deb6348698007df8250fe41208 /drivers/power/supply/max1721x_battery.c | |
parent | power: remove possible deadlock when unregistering power_supply (diff) | |
download | linux-09bebb1adb21ecd04adf7ccb3b06f73e3a851e93.tar.xz linux-09bebb1adb21ecd04adf7ccb3b06f73e3a851e93.zip |
power: vexpress: fix corruption in notifier registration
Vexpress platforms provide two different restart handlers: SYS_REBOOT
that restart the entire system, while DB_RESET only restarts the
daughter board containing the CPU. DB_RESET is overridden by SYS_REBOOT
if it exists.
notifier_chain_register used in register_restart_handler by design
relies on notifiers to be registered once only, however vexpress restart
notifier can get registered twice. When this happen it corrupts list
of notifiers, as result some notifiers can be not called on proper
event, traverse on list can be cycled forever, and second unregister
can access already freed memory.
So far, since this was the only restart handler in the system, no issue
was observed even if the same notifier was registered twice. However
commit 6c5c0d48b686 ("watchdog: sp805: add restart handler") added
support for SP805 restart handlers and since the system under test
contains two vexpress restart and two SP805 watchdog instances, it was
observed that during the boot traversing the restart handler list looped
forever as there's a cycle in that list resulting in boot hang.
This patch fixes the issues by ensuring that the notifier is installed
only once.
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Fixes: 46c99ac66222 ("power/reset: vexpress: Register with kernel restart handler")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Diffstat (limited to 'drivers/power/supply/max1721x_battery.c')
0 files changed, 0 insertions, 0 deletions