[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250605091650.51093-1-me@linux.beauty>
Date: Thu, 5 Jun 2025 17:16:50 +0800
From: Li Chen <me@...ux.beauty>
To: Benjamin Tissoires <bentiss@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH] HID: rate-limit hid_warn to prevent log flooding
From: Li Chen <chenl311@...natelecom.cn>
Syzkaller can create many uhid devices that trigger
repeated warnings like:
"hid-generic xxxx: unknown main item tag 0x0"
These messages can flood the system log, especially if a crash occurs
(e.g., with a slow UART console, leading to soft lockups). To mitigate
this, convert `hid_warn()` to use `dev_warn_ratelimited()`.
This helps reduce log noise and improves system stability under fuzzing
or faulty device scenarios.
Signed-off-by: Li Chen <chenl311@...natelecom.cn>
---
include/linux/hid.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 568a9d8c749bc..a73caa9fd1896 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -1238,7 +1238,7 @@ void hid_quirks_exit(__u16 bus);
#define hid_notice(hid, fmt, ...) \
dev_notice(&(hid)->dev, fmt, ##__VA_ARGS__)
#define hid_warn(hid, fmt, ...) \
- dev_warn(&(hid)->dev, fmt, ##__VA_ARGS__)
+ dev_warn_ratelimited(&(hid)->dev, fmt, ##__VA_ARGS__)
#define hid_info(hid, fmt, ...) \
dev_info(&(hid)->dev, fmt, ##__VA_ARGS__)
#define hid_dbg(hid, fmt, ...) \
--
2.49.0
Powered by blists - more mailing lists