HID: rate-limit hid_warn to prevent log flooding
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.
Signed-off-by Li Chen <[email protected]>
--- include/linux/hid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/hid.h +1 -1
@@ -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