The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] platform/chrome: cros_ec_debugfs: unregister panic notifier on remove
@ 2026-06-15  6:32 Pengpeng Hou
  2026-06-16  5:53 ` Tzung-Bi Shih
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-06-15  6:32 UTC (permalink / raw)
  To: Benson Leung, Tzung-Bi Shih, Guenter Roeck, chrome-platform,
	linux-kernel
  Cc: pengpeng

cros_ec_debugfs_probe() registers a panic notifier whose callback
recovers struct cros_ec_debugfs with container_of() and can schedule or
flush the console log work.

cros_ec_debugfs_remove() removes debugfs state and cleans up the console
log buffer, but it leaves the notifier registered.  A later panic
notification can therefore call back into freed debugfs state.

Unregister the panic notifier before tearing down the debugfs and log
state.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/platform/chrome/cros_ec_debugfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c
index d10f9561990c..a19de7d418fe 100644
--- a/drivers/platform/chrome/cros_ec_debugfs.c
+++ b/drivers/platform/chrome/cros_ec_debugfs.c
@@ -530,6 +530,8 @@ static void cros_ec_debugfs_remove(struct platform_device *pd)
 {
 	struct cros_ec_dev *ec = dev_get_drvdata(pd->dev.parent);
 
+	blocking_notifier_chain_unregister(&ec->ec_dev->panic_notifier,
+					   &ec->debug_info->notifier_panic);
 	debugfs_remove_recursive(ec->debug_info->dir);
 	cros_ec_cleanup_console_log(ec->debug_info);
 }
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-16  5:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-15  6:32 [PATCH] platform/chrome: cros_ec_debugfs: unregister panic notifier on remove Pengpeng Hou
2026-06-16  5:53 ` Tzung-Bi Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox