From: sashiko-bot@kernel.org
To: "Jaegyun Lee" <dreams200260@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH] HID: chicony: fix NULL dereference in ch_report_wireless
Date: Sat, 05 Dec 2026 03:37:27 +0000 [thread overview]
Message-ID: <sashiko-outbox-250987@kernel.org> (raw)
In-Reply-To: <20261205032508.1267520-1-dreams200260@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] HID: chicony: unratelimited hid_warn() in IRQ context in
ch_report_wireless()
--
commit 3ba1132e82880f936838b3d05ef6b879bd19eb9e
Author: Jaegyun Lee <dreams200260@gmail.com>
HID: chicony: fix NULL dereference in ch_report_wireless
This commit checks report->field[0]->hidinput for NULL before
dereferencing it in ch_report_wireless(), falling into the existing
!input warning path instead of crashing.
> diff --git a/drivers/hid/hid-chicony.c b/drivers/hid/hid-chicony.c
> index 5776ec2e7159a..cce5042490c76 100644
> --- a/drivers/hid/hid-chicony.c
> +++ b/drivers/hid/hid-chicony.c
> @@ -26,12 +26,14 @@
> static int ch_report_wireless(struct hid_report *report, u8 *data, int size)
> {
> struct hid_device *hdev = report->device;
> + struct hid_input *hidinput;
> struct input_dev *input;
>
> if (report->id != CH_WIRELESS_CTL_REPORT_ID || report->maxfield != 1)
> return 0;
>
> - input = report->field[0]->hidinput->input;
> + hidinput = report->field[0]->hidinput;
> + input = hidinput ? hidinput->input : NULL;
> if (!input) {
> hid_warn(hdev, "can't find wireless radio control's input");
> return 0;
[Severity: Medium]
Can this hid_warn() now flood the kernel log from IRQ context?
Before this change, a NULL report->field[0]->hidinput faulted before the
!input check, so this warning was unreachable. Now a device whose report
ID 0x11 has no mapped input triggers hid_warn() on every report via
hid_irq_in() -> __hid_input_report() -> ch_raw_event().
Because field[0]->hidinput stays NULL and hid_warn() is an unratelimited
dev_warn(), repeated reports at USB polling rates can flood the log and
cause console lock contention or soft lockups on serial consoles. Using
hid_warn_once() with a trailing newline would avoid repeated warnings.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205032508.1267520-1-dreams200260@gmail.com?part=1
prev parent reply other threads:[~2026-12-05 3:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 3:25 [PATCH] HID: chicony: fix NULL dereference in ch_report_wireless Jaegyun Lee
2026-12-05 3:37 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-250987@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=dreams200260@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox