Re: [PATCH v3] HID: rate-limit hid_warn to prevent log flooding

From: Jiri Kosina
Date: Fri Jun 20 2025 - 09:35:29 EST


On Fri, 20 Jun 2025, Li Chen wrote:

> From: Li Chen <chenl311@xxxxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxxxx>
> ---
> Changelog:
>
> v2: Introduce hid_warn_ratelimited to rate-limit the specified log.
> v3: also ratelimit "reserved main item tag ..."

Applied, thanks.

--
Jiri Kosina
SUSE Labs