diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2026-11-05 21:18:53 -0800 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-11-08 17:45:19 -0800 |
| commit | 3ada899b7c012885a53f4178a1f5cbd20919e8b4 (patch) | |
| tree | d4a1e2fcf8a35b9629168d8a7a7d18c08d718e3d /tools/perf/scripts/python | |
| parent | 4174239c6702e313ccc7c0d6c216335f2ebe704a (diff) | |
watchdog: mediatek: Register reset controller before watchdog device
In mtk_wdt_probe(), devm_watchdog_register_device() is called before
registering the TOPRGU reset controller via
toprgu_register_reset_controller().
Because devm_watchdog_register_device() immediately exposes
/dev/watchdog to userspace, mtk_wdt_probe() transiently publishes the
watchdog character device, registers reboot and restart handlers, and
logs that the watchdog is enabled before probe can still fail in
toprgu_register_reset_controller(). Furthermore, if userspace opens
/dev/watchdog during this window and starts the hardware counter, and
toprgu_register_reset_controller() then fails, devres unregisters
/dev/watchdog and cancels the core keepalive worker without stopping
the hardware watchdog (as WDOG_STOP_ON_UNREGISTER is not set), leaving
the timer armed and causing an unexpected system reset.
Initialize the TOPRGU reset controller data and call
toprgu_register_reset_controller() before mtk_wdt_init() and
devm_watchdog_register_device() so the watchdog is only initialized and
exposed after reset controller registration succeeds.
Fixes: c254e103082b ("watchdog: mtk_wdt: mt8183: Add reset controller")
Reported-by: Sashiko <sashiko@sashiko.dev>
Link: https://sashiko.dev/#/bug/linux-edb0d208-f5a5-496a-a6b3-caaa85d72719
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
