From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-m155101.qiye.163.com (mail-m155101.qiye.163.com [101.71.155.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAAC7257854 for ; Tue, 28 Jul 2026 12:34:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=101.71.155.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785242072; cv=none; b=Pr4LaYFjcPkUFoho9zaMxFG6g6oJyDe18b+imMj/A7QqeDIgMBvxWhT55bf6SIg+vfAg2PrYkU5vJBOfXSplfaRrW8hbLqc7ObxFLzkneNglyhQFDuIOxw60VBJm5T9F+h/3GwE9HuIs+S5b1qqMEDZlM1dOnNJw3z7sHAicJOs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785242072; c=relaxed/simple; bh=htDpTgzApN0KcVwKIBV5f4H5ahf07fFYbYFAntTuWio=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=snqVz0eZtxTV6Pe55PsvoXxDdsTzPQLkmeVhmbZddsi2kA1cF8euWH1ttReyYIpBA2G8nMGYUYhT3/pJSIFXwAD/ar2zDangvwTNQr7l4NLeDhIOvi2rFYKVg+viCZWKv73Zu8Nrz0slVMwg0zgv7kwXomi6VeIaXZPWTUxkYVA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seu.edu.cn; spf=pass smtp.mailfrom=seu.edu.cn; dkim=pass (1024-bit key) header.d=seu.edu.cn header.i=@seu.edu.cn header.b=MZa3Mf+a; arc=none smtp.client-ip=101.71.155.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seu.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=seu.edu.cn Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=seu.edu.cn header.i=@seu.edu.cn header.b="MZa3Mf+a" Received: from LAPTOP-99KJFSET (unknown [221.228.238.82]) by smtp.qiye.163.com (Hmail) with ESMTP id 47e10a90a; Tue, 28 Jul 2026 20:34:26 +0800 (GMT+08:00) From: Hongyan Xu To: bleung@chromium.org, tzungbi@kernel.org Cc: Hongyan Xu , groeck@chromium.org, chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, jianhao.xu@seu.edu.cn Subject: [PATCH] platform/chrome: cros_ec_debugfs: unregister panic notifier Date: Tue, 28 Jul 2026 20:33:37 +0800 Message-ID: <20260728123423.781-3-getshell@seu.edu.cn> X-Mailer: git-send-email 2.50.1.windows.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-HM-Tid: 0a9fa8b81f1503a1kunm4c64fbaeeecf0 X-HM-MType: 10 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVlDHkseVkhOTk1KS08fH0sfQlYeHw 5VEwETFhoSFyQUDg9ZV1kYEgtZQVlJSUpVSUlDVUlIQ1VDSVlXWRYaDxIVHRRZQVlPS0hVSktJSE 5DQ1VKS0tVS1kG DKIM-Signature: a=rsa-sha256; b=MZa3Mf+a8vyCQepXTCA8PSGyuXpNr3y16rUXJlaLZFs7Wd6t/O6O95WWoe1s1DQXA+LAj2PSUggRc2BgDDUKx7fsZrX8RqdHesvihVJ81eYyIm+pzEt8xKqlbLKUB6UuaUIeXu0zdlfjndFRvRVjsHi059boYHf/FYjKc+dgUiM=; s=default; c=relaxed/relaxed; d=seu.edu.cn; v=1; bh=8ItZWwmcNMbf6/znp6fsrEvBd0tgSjfbDcAYwJJ4a3U=; h=date:mime-version:subject:message-id:from; cros_ec_debugfs_probe() registers debug_info->notifier_panic with the EC panic notifier chain. The remove path tears down debugfs and cancels the console log work, but leaves the notifier on the chain. A later panic notification can call back into a removed driver instance and reschedule the delayed work. Unregister the notifier before tearing down debugfs state. Also run the console-log cleanup in the probe error path. This issue was found by a static analysis tool. Signed-off-by: Hongyan Xu --- drivers/platform/chrome/cros_ec_debugfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c index 92ac9a2f9..6f93aedbd 100644 --- a/drivers/platform/chrome/cros_ec_debugfs.c +++ b/drivers/platform/chrome/cros_ec_debugfs.c @@ -534,6 +534,7 @@ static int cros_ec_debugfs_probe(struct platform_device *pd) return 0; remove_debugfs: + cros_ec_cleanup_console_log(debug_info); debugfs_remove_recursive(debug_info->dir); return ret; } @@ -542,6 +543,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.windows.1