Skip to contentSkip to conversation

HID: rate-limit hid_warn to prevent log flooding

PATCH Superseded Li Chen 1 participant 1 message Jun 5, 2025 HID

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Li Chen

author
#0 lore raw

PATCH 1/1 HID: rate-limit hid_warn to prevent log flooding

From: Li Chen <[email protected]>

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.

---
 include/linux/hid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/hid.h +1 -1
index 568a9d8c749bc..a73caa9fd1896 100644
@@ -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, ...)				\
Signature · 1 line
2.49.0