HID: rate-limit hid_warn to prevent log flooding
authorLi Chen <chenl311@chinatelecom.cn>
Fri, 20 Jun 2025 12:02:31 +0000 (20:02 +0800)
committerJiri Kosina <jkosina@suse.com>
Fri, 20 Jun 2025 13:34:36 +0000 (15:34 +0200)
commit4051ead99888f101be92c7ce90d2de09aac6fd1c
tree59a2d804ef25d93b1dfd6fb56af8504f91ffe14a
parent37a9acb971c2f338e7a1b602b0ee40ad70668e81
HID: rate-limit hid_warn to prevent log flooding

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@chinatelecom.cn>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/hid-core.c
include/linux/hid.h